Reset Samba User Password via Command Line

Posted on

This is an article describe on how to reset a user defined in samba folder and file sharing service. As we already knew that samba folder and file sharing service has its own sharing definition’s access.

To create a user for samba access, read the following article titled ‘Add Samba User in Linux with smbpasswd‘. After successfully created user with the specified command described in that article, in case there is something happened such as password for samba user is forgotten or any other conditions met to force or reset the password below is how to accomplish the purpose, just execute the following command :

smbpasswd username

For an example, the execution of the above username in a real situation is shown below :

[root@hostname ~]$ smbpasswd -U user
New SMB password:
Retype new SMB password:
[root@hostname ~]$

The above output happened on a server where the account named ‘user’ has already exist as a real account on the operating system. And it is for the first time, the password for using samba is defined for the user itself. Check the output generated below if the password for samba service on the account has already been defined :

[root@hostname ~]$ smbpasswd -U user
Old SMB password:
New SMB password:
Retype new SMB password:
Password changed for user user
[root@hostname ~]$

Try to compare it with the following output generated where the command for set or change the password is performed to an account named ‘myuser’ which is not exist on the operating system as a real account :

[root@dev ~]# smbpasswd myuser
New SMB password:
Retype new SMB password:
Failed to find entry for user myuser.
[root@dev ~]#

As it can be seen in the above output, it can be concluded that samba doesn’t have any record of its own user account but it specifically uses the account which has already created and registered on the system. So, the password which is used for accessing or using samba services is definitely different with the one defined for accessing the operating system.

2 thoughts on “Reset Samba User Password via Command Line

Leave a Reply