homehowtokbslinksaboutcontactprojectsmusic

Index > Knowledge Base > Samba
To rename the machine account in samba, add the following line in you smb.conf file
rename user script = /usr/sbin/smbldap-usermod -r '%unew' '%uold'
Check samba config and status
testparm
smbstatus
Mount samba share in linux using password file
Install cifs-utils package
sudo apt-get install cifs-utils
Create password file and set its permission
nano ~/.smbcred
Paste the following in the file, make sure to change user and pass, save the file and exit once done
username=user
password=pass
Secure the file
chmod 600 ~/.smbcred
Edit the fstab file
nano /etc/fstab
And past the following in it, save and exit once done
//smbsrv/smbshare /mnt/smbshare cifs credentials=/home/username/.smbcred,iocharset=utf8,sec=ntlm 0 0 
Try mounting the share
mount -a
Restart remote windows machine, ajust the values of ipaddress, username and password
net rpc shutdown -r -C "This machine is going for restart in 60 seconds" -I ipaddress -U username%password
See samba connection to samba shares
smbstatus -S
See who is connected to samba
smbstatus -b

Samba4

add users
samba-tool add user rkhan Test123 --userou=ou=people
add group
samba-tool group add radius --groupou=ou=groups
add members to group
samba-tool group addmembers radius rkhan
list members of radius group
samba-tool group listmembers radius
remove user
samba-tool user delete rkhan
remove group
samba-tool group delete radius
remove members from group
samba-tool group removemembers radius rkhan
Edit user, adjust the samaccountname
ldbedit -e nano -H /var/lib/samba/private/sam.ldb "(samaccountname=rkhan)"
# stops the syslog being spammed by the lack of a CUPS server.
printing = CUPS
printcap name = /dev/null