#install software

# CentOS7
yum update && yum install samba-client samba-common cifs-utils

# Debian
hostnamectl; # tested on (server + client)
Operating System: Debian GNU/Linux 12 (bookworm) 
Kernel: Linux 6.1.0-18-amd64
Architecture: x86-64

# and older
# (GNU) Linux Debian 3.16.0-4-686-pae
# 1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) i686 GNU/Linux

# on client
# install software
apt-get update && apt-get install cifs-utils
# create mountpoint
mkdir -p /media/ClientDefaultUser/mountpoint/

# 
mount -t cifs //FILE-SERVER-IP-ADDRESS/NAME_OF_SHARE /media/ClientDefaultUser/mountpoint/ --verbose -o user=nobody;
# mount windows share, you will be asked for password

mount -t cifs //FILE-SERVER-IP-ADDRESS/NAME_OF_SHARE /media/ClientDefaultUser/mountpoint/ --verbose -o user=nobody,password=secret;
# bad security practice, but conveniant for user won't be bothered entering a password manually
# would be great if smb-samba would simply also re-use the ssh-public-private-key auth system... too simple? :D
 
# on server
# create SambaUserOnServer
# but SambaUserOnServer does not have to exist on client_system
useradd -m SambaUserOnServer
passwd SambaUserOnServer
smbpassword -a SambaUserOnServer

# in order to have zero access permission problems on the client
# find out what is the UserID and GroupID of "ClientDefaultUser"
id ClientDefaultUser
uid=1003(ClientDefaultUser) gid=1003(ClientDefaultUser) groups=1003(ClientDefaultUser),106(netdev),113(bluetooth),128(libvirt)
# on client:  mount with the userid + groupid of client default-non-root-user
# the one who is running the desktop) = zero file permission problems
mount -t cifs -o username=SambaUserOnServer,uid=1003,gid=1003 //192.168.122.100/sharename /media/ClientDefaultUser/mountpoint/

# another example:
sudo mount -t cifs -o username=otto,password=geheim,uid=1000,gid=1000,file_mode=0660,dir_mode=0770 //192.168.1.100/Tausch /media/austausch

# if host (older QNAP NAS) does not support smb 2.0
# and one needs to use (insecure! ETHERNAL BLUE!) smb 1.0
mount -t cifs -o vers=1.0,username=smbuser,password=smbpwd //192.168.1.100/sharename /run/media/user/mountpoint;

Related Links:

greetings from ethernal blue – linux cifs smb windows share mount fails with “mount error(112): host is down” – no it is not

https://wiki.ubuntuusers.de/Samba_Client_cifs/

 

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin