掛載目錄的命令
阿新 • • 發佈:2018-11-06
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