linux mount mount Shared directory details

  • 2020-05-27 07:57:47
  • OfStack

Mount windows Shared directory or FTP:

Option 1: include password


sudo mount //192.168.10.22/FTPServer /windows -o username=user,password=abcdefg -t cifs 

Option 2: enter the password separately


sudo mount //192.168.10.22/FTPServer /windows -o username=user -t cifs 
password : abcdefg 

Uninstall:


umount /FTPServer 

Mount linux Shared directory:

[modify server terminal]

Modify /etc/export file to add:


/home/user/source *(rw) 

Execute the following command to allow the new share to take effect


$/etc/rc.d/init.d/nfs restart 

[client] mount the share by executing the following command:


mount -t nfs -o rw 192.168.10.94:/home/user/source /home/user/target 

Set automatic mount on startup

1. Change the password of mount_AtoB.sh

2. Put the mount_AtoB.sh file into /home/user

3. Change the execution permission of the file and execute the following command:


chmod 777 mount_AtoB.sh 

4. Add the file to the startup file:


$ echo /home/user/mount_94to93.sh >> /etc/rc.d/rc.local 

mount_AtoB.sh file contents, where abcdefg is the password of 192.168.10.94:


set fileformat=unix 
#!bin/bash 
mount -t nfs -o rw 192.168.10.94:/home/user/source /home/user/target <<EOF 
abcdefg 
EOF 

Related articles: