• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

smbpasswd Command Examples in Linux

by Deepika

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.

Filed Under: Linux

Some more articles you might also be interested in …

  1. cp: Copy files and directories
  2. ksh Command Examples
  3. whiptail: command not found
  4. git cherry: Find commits that have yet to be applied upstream
  5. “hg branch” Command Examples
  6. /proc/cpuinfo file explained
  7. lpinfo Command Examples
  8. “hg init” Command Examples
  9. strip: command not found
  10. firejail Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright