Create user with bash shell, home directory and sudo group
useradd -m -d /home/testuser/ -s /bin/bash -G sudo testuser-m creates the home directory if it does not exist.
-d overrides the default home directory location. -s sets the login shell for the user.
-G expects a comma-separated list of groups that the user should belong to.
See man useradd for details.
https://unix.stackexchange.com/questions/182180/why-is-the-home-directory-not-created-when-i-create-a-new-user
Change user password:
sudo passwd USERNAME
https://askubuntu.com/questions/423942/change-password-on-root-user-and-user-account
Display group of user
id user
Display all group
less /etc/group
Less is a command line utility that displays the contents of a file or a command output, one page at a time. It is similar to more , but has more advanced features and allows you to navigate both forward and backward through the file.Jul. 3, 2019
https://websiteforstudents.com/how-to-list-all-user-groups-on-ubuntu-18-04-16-04-with-examples/
Add Group to User:
sudo usermod -a -G groupName userName
https://askubuntu.com/questions/79565/how-to-add-existing-user-to-an-existing-group
need to logout and login to get the groups permissions from /etc/group
Add home directory to existing user :
sudo mkhomedir_helper username
https://askubuntu.com/questions/152707/how-to-make-user-home-folder-after-account-creation
Add Bash Shell to existing user:
sudo chsh -s /bin/bash username
(chsh -> change shell -s -> shell)
You must log out and log back in to see this change.
Without bash shell, cant use many commands such as source, .(execute)https://superuser.com/questions/46748/how-do-i-make-bash-my-default-shell-on-ubuntu
What is shellThe shell is the command interpretor in an operating system such as Unix or GNU/Linux, it is a program that executes other programs. It provides a computer user an interface to the Unix/GNU Linux system so that the user can run different commands or utilities/tools with some input data.
Bash stands for Bourne Again Shell and it is the default shell on many Linux distributions today. It is also a sh-compatible shell and offers practical improvements over sh for programming and interactive use which includes:
- Command line editing
- Job Control
- Unlimited size command history
- Shell Functions and Aliases
- Unlimited size Indexed arrays
- Integer arithmetic in any base from two to sixty-four
https://www.tecmint.com/different-types-of-linux-shells/#:~:text=The%20shell%20is%20the%20command,tools%20with%20some%20input%20data.
No comments:
Post a Comment