挂载目录的命令

mount -t cifs //172.16.18.193/html /root/meeting/userprofiles -o username=xxx,password=xxx

场景:前端静态资源在193服务器上,后台程序在201服务器上,将193的实际目录挂载(映射)到201的对应目录上

注意:mount 默认只在 root 用户下有效;如果想在其他用户下使用 mount 命令需要用 sudo 提升普通用户的权限(即在前面加上 sudo) 

mount -t cifs -o username=xxx,password=xxx,uid=jenkins,gid=jenkins //172.16.18.193/html/meeting/res/img/userprofiles /var/lib/jenkins/workspace/userprofiles/profilephoto

说明:挂载到非 root 用户下的目录需要挂载时指定用户,后期无法修改。
    uid------非 root 用户的用户名
    gid------非 root 用户的组名,一般同用户名
    /172.16.18.193/html/meeting/res/img/userprofiles------实际操作的目录
    /var/lib/jenkins/workspace/userprofiles/profilephoto------被挂载到当前linux系统的目录
    username、password------193的用户名和密码

解除挂载:

umount /var/lib/jenkins/workspace/userprofiles/profilephoto

猜你喜欢

转载自blog.csdn.net/Victoria__W/article/details/83143023