We have already installed Samba Server to share directories from our PC. Lets install a sambaclient to access those shared directories.
Install samba client
$ sudo pacman -S smbclient
Configure the samba client, you can create an empty conf file.
SKIP THIS STEP IF YOU HAVE ALREADY CONFIGURED THE /etc/samba/smb.conf WHILE INSTALLING SAMBA
$ sudo touch /etc/samba/smb.conf
Ok all done, lets explore the server
$ smbtree -b -N
The above will show all shared hosts
To query specific one, my server name is TECNOTCH
$ smbclient -L TECNOTCH -U%
Lets mount the shared directory to our file system so we can access it through terminal or file manager
Create a directory where the shared directory will be mounted
i.e
$ sudo mkdir /mnt/TECNOTCH
mount shared folder on server TECNOTCH to /mnt/TECNOTCH
I have my shared directory entry as follow in SAMBA server configuration when installing SAMBA on server.
[shared] comment = TECNOTCH Shared Files path = /mnt/data/shared
So my share name is shared, the name of section [shared]
//TECNOTCH/shared represents //ServerName//section-name-of-shared-directory
$ sudo mount -t cifs //TECNOTCH/shared /mnt/TECNOTCH -o username=tofeeq,password=mypassword,workgroup=DEVTEAM,iocharset=utf8,uid=1000,gid=users,vers=3.1.1,nodfs --verbose
If you don’t see any error that means shared directory on server is mounted on my local directory
You can start accessing shared folders.
You can add that mount entry to /etc/fstab so it would be auto-mount on access
$ sudo vi /etc/fstab
Append following line at the end
//TECNOTCH/shared /mnt/TECNOTCH cifs x-systemd.automount,username=tofeeq,password=mypassword,workgroup=DEVTEAM,iocharset=utf8,uid=1000,gid=users,vers=3.1.1 0 0
To automount shared directories on boot start systemd-networkd-wait-online.service
$ sudo systemctl enable systemd-networkd-wait-online.service $ sudo systemctl start systemd-networkd-wait-online.service
2 Responses
[…] Congratulations, your samba server is up and running, now you can access your linux server’s shared folders from any other pc including windows. To access them on linux you need to have samba client and mount network directory. […]
[…] Install Samba Client to Access Shared Directories by Server […]