Tuesday, October 17, 2017

Access Windows Shares from Linux Machine SSH Console

Mount Windows share using mount command


Use command line tool called smbclient or you can mount windows shares the mount command. Another option is use GUI tools. Please refer previous articles about access windows share from Linux

Here we are going to access windows share :\\192.168.1.1\share

# mkdir -p /mnt/share
# mount -t smbfs -o username=administrator,password=password //192.168.1.1/share /mnt/win

Note: If you face error related to file systems, smbfs filesystem not found, you can use cifs instead of smbfs.

# cd /mnt/share
# ls -l

For the share //192.168.1.1/share to be automatically mounted at every system start (after reboot), insert an option in the file /etc/fstab:

# vi /etc/fstab
Append following line (written in a single line)


//192.168.1.1/share /mnt/share smbfs auto,gid=users,fmask=0664,dmask=0775,iocharset=iso8859-15, credentials=/etc/sambapasswords 0 0

Next create the password file /etc/sambapasswords:


# vi /etc/sambapasswords
Now add following content:
username = Administrator
password = password

Save and close the file. Make sure only root can access your file:
# chown 0.0 /etc/sambapasswords
# chmod 600 /etc/sambapasswords


You can Also Mount CISF Windows Share Files.


Common Internet File System is an application-level network protocol mainly used to provide shared access to files, printers, serial ports, and miscellaneous communications between nodes on a network. You can easily access CIFS share from Linux and mount them as a regular filesystem.

mkdir -p /mnt/share

# mount -t cifs //192.168.1.10/share /mnt/share -o username=Administrator,password=password,domain=testdomain

OR

# mount.cifs //192.168.1.10/share /mnt/share -o username=Administrator,password=password,domain=testdomain

No comments:

Post a Comment