Configured as a standalone server, Samba's resources will be made available in either share mode or in user mode. This means that all passwords are associated with an existing system account, so start by creating a new CentOS user.
Log in as root and create a new system group by typing
# groupadd sambausers
Now create a new system user and add them to the new group
# useradd username -m -G sambausers
This will create a new user profile and establish an associated user ID, make the relevant home directory (-m), set the default shell to bash, and add them to a group called sambausers.
Now to create a Samba password for the new user
# smbpasswd -a username
The user name being the name set up earlier, at the prompt give the password you wish to use.
Samba does not manage usernames, but it enables you to create a password for a valid system user account. The Samba user is inextricably tied to this account so first we create a new CentOS group.
All system users should belong to a group and in this instance we create a group called sambausers.
We all know that servers can maintain any number of users, but by creating a relationship between them, you can provide a common rule that will enable the members of the same group to read, write, and execute specific files and directories.
In many respects, groups represent the principle component of an organization, and this not only makes the task of administration much easier, but it also enables you to develop a subset of user-based rights that is based on a group privilege.
Disable and Delete a Samba user
To disable a samba user, log in as root and type
# smbpasswd -d username
To delete a Samba user, log in as root and type
# smbpasswd -x username
By deleting the password you will not be removing the associated user profile (username) from the server or affecting the relevant home directory and its contents.
So there is always an option of re-enabling the account at any time. However, if you would like to delete these items permanently, then you must use the following command
# userdel –r username
Use the –r flag to delete the user, the associated home directory and the mail spool.
Labels: add, Centos 6, delete, disable a Samba user, RHEL