A. The mount_smbfs command mounts a share from a remote server using SMB/CIFS protocol. You can easily mount NAS share using the following syntax:
mount_smbfs -I 1.2.3.4 //username@nasserver/share /path/to/local/mnt
Mount data share from nas05 nas server at /nas05 directory, enter:
# mkdir /nas05
# mount_smbfs -I 10.1.2.3 //vivek@nas05/data /nas05
You will be prompted for your password. Once this happens you can change to the directory and view the contents using cd and ls command.
# cd /nas05
# ls
# cp /path/to/file .
# ls -l
Where,
- -I 10.1.2.3 : Do not use NetBIOS name resolver and connect directly to host, which can be either a valid DNS name or an IP address.
- vivek : Your user name.
- nas05 : NETBIOS Server Name.
- /data : CIFS share name.
- /nas05 : Local mount point directory.
Avoid password prompt
You need to create a ~/.nsmbrc file as follows:# vi ~/.nsmbrc
Set username and password as follows:
[NAS05:VIVEK]Now mount NAS as follows:
password=myPassword
# mount_smbfs -N -I 10.1.2.3 //vivek@nas05/data /nas05
The -N option forces to read a password from ~/.nsmbrc file. At run time, mount_smbfs reads the ~/.nsmbrc file for additional configuration parameters and a password. If no password is found, mount_smbfs prompts for it. You need to use the -N option while writing a shell script.
No comments:
Post a Comment