User Tools

Site Tools


samba:create-user

Creating Samba users & groups from the command line

You can create your users & groups using ADUC from Windows, or else you can create the from the command line. If you are using the 'ad' idmap backend, I suggest you use the command line. Any field can be edited from ADUC later if needs be.

You can script the following commands, make sure you have all variable values in place.

Creating Users

Using the 'ad' backend'

samba-tool user create $username $password --given-name=$name --surname=$surname --use-username-as-cn --home-drive=S: --home-directory=\\\\FS1\\users\\$username --mail-address="$username@caponato.es" --must-change-at-next-login --nis-domain=mad --uid-number=$lastuid --login-shell=/dev/null

Remeber, if you are using the 'ad' backend you must keep track of uidNumbers. Make sure you write down your last $lastuid !

Using the 'rid' backend'

If you are using the 'rid' backend, you command should look like this:

samba-tool user create $username $password --given-name=$name --surname=$surname --use-username-as-cn --home-drive=S: --home-directory=\\\\FS1\\users\\$username --mail-address="$username@caponato.es" --must-change-at-next-login 

Creating Groups

If you are using the 'rid' backend:

samba-tool group add my-new-group 

If you are using the 'ad' backend :

You need to add gidNumber and nis-domain

samba-tool group add my-new-group --gid-number=10031 --nis-domain=mad

Remeber, if you are using the 'ad' backend you must keep track of gidNumbers. To make sure you write down your last gidNumber used!!!


Caponato's Samba notebook. Start here or else Main menu

samba/create-user.txt ยท Last modified: 2024/04/25 18:48 by caponato