Mount windows share on linux (centos 6.5)
# yum install cifs-utils
[to unmount # umount /mounteddir OR incase of lock errors #umount -l (small 'L') ]
//server/share /mnt/mountname cifs username=server_user,password=user_password,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
Where,
server = your server that you are trying to access
share = mapped share on that server
/mnt/mountname = any folder that you created with sudo /mnt/<folder_name>
username = the name of the user on that server that can access the mount
password = the password for that user
After that you can test with sudo mount -a, if you dont get any faults you can safely reboot to find your shares mounted in /mnt/<folder_name>.
To use a credentials file instead of the username and password parameters on the fstab you can create a file with those 2 lines so that your username and password are not explicitly shown in the fstab
sudo nano /etc/cifspwd
Add these lines to the file
username=<username on server>
password=<password for that username>
Press ctrl+x keys and when asked press y to save the file.
Secure it with
sudo chmod 600 /etc/cifspwd
Use this line instead of the previous
//server/share /mnt/mountname cifs credentials=/etc/cifspwd,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
myexample
cat /etc/fstab
..
//172.69.2.250/mrhost /backup cifs credentials=/unc.txt,filemode=0660,dirmode=0770,iocharset=utf8,sec=ntlm 0 0
#chmod 660 /unc.txt
#cat /unc.txt
username=user234
password=p@ssw0rd
# yum install cifs-utils
[to unmount # umount /mounteddir OR incase of lock errors #umount -l (small 'L') ]
//server/share /mnt/mountname cifs username=server_user,password=user_password,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
Where,
server = your server that you are trying to access
share = mapped share on that server
/mnt/mountname = any folder that you created with sudo /mnt/<folder_name>
username = the name of the user on that server that can access the mount
password = the password for that user
After that you can test with sudo mount -a, if you dont get any faults you can safely reboot to find your shares mounted in /mnt/<folder_name>.
To use a credentials file instead of the username and password parameters on the fstab you can create a file with those 2 lines so that your username and password are not explicitly shown in the fstab
sudo nano /etc/cifspwd
Add these lines to the file
username=<username on server>
password=<password for that username>
Press ctrl+x keys and when asked press y to save the file.
Secure it with
sudo chmod 600 /etc/cifspwd
Use this line instead of the previous
//server/share /mnt/mountname cifs credentials=/etc/cifspwd,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0
myexample
cat /etc/fstab
..
//172.69.2.250/mrhost /backup cifs credentials=/unc.txt,filemode=0660,dirmode=0770,iocharset=utf8,sec=ntlm 0 0
#chmod 660 /unc.txt
#cat /unc.txt
username=user234
password=p@ssw0rd
No comments:
Post a Comment