smbpasswd Command Examples in Linux

smbpasswd is a command-line utility that is used to add, remove, or modify Samba users and their passwords. Samba is a popular open-source implementation of the SMB (Server Message Block) protocol, which is used for file and printer sharing on Windows-based networks.

In order to use Samba, users must have an existing local Unix account. The smbpasswd command is used to set up the Samba password for a user, which is separate from the Unix password. The Samba password can be the same as the Unix password, but it does not have to be.

The smbpasswd command can be used to create new Samba users, delete existing ones, or modify their passwords. It supports various options for setting password expiration, changing the password encryption algorithm, and specifying user rights and permissions.

Using smbpasswd is an essential part of managing Samba servers and users. It can be used to grant or restrict access to files and printers on a network, and to ensure that user accounts are properly secured.

smbpasswd Command Examples

1. Change the current user’s SMB password:

# smbpasswd

2. Add a specified user to Samba and set password (user should already exist in system):

# sudo smbpasswd -a username

3. Modify an existing Samba user’s password:

# sudo smbpasswd username

4. Delete a Samba user (use `pdbedit` instead if the Unix account has been deleted):

# sudo smbpasswd -x username

Summary

In summary, smbpasswd is a useful utility for managing Samba users and their passwords. Its ability to create, delete, and modify Samba user accounts, along with its support for password expiration, encryption algorithms, and user rights, makes it an important tool for managing Samba servers and ensuring network security.

Related Post