I have a Samba server for about 5 users (security = user) and I want a way for these users to change their passwords without my involvement so I have the following idea. Is this secure? Is there a better (as in more simple) approach. We used to have SWAT for this but no more.
On server: create restricted user (/bin/rbash + PATH to single directory)
$ sudo adduser --shell /bin/rbash pwchange
$ cat /etc/passwd
pwchange:x:1001:1001:pwchange,,,:/home/pwchange:/bin/rbash
$ sudo vi /home/pwchange/.bashrc
Add:
export PATH=/usr/local/pwchange
$ sudo ln -s /usr/bin/smbpasswd /usr/local/pwchange/smbpasswd
This idea here is that only the sambpasswd command can be run by the pwchange user. The unix accounts for the Samba users do not have passwords (i.e. log on via these accounts not allowed). The samba users would only be able to use this restricted account for self service Samba password changes ... no exploring the server!
Client: Change Samba password via Terminal or Putty (Windows)
user1@A3700:~$ ssh pwchange@192.168.1.14
pwchange@V220:~$ smbpasswd -U user1
Old SMB password:
New SMB password:
Retype new SMB password:
Password changed for user user1
smbpasswd
was meant for users and admin alike to change their passwords... Is that what you want? – George Udosen Dec 17 '17 at 05:07