Linux Administration ( part 1): creating users in Linux

HackPeas Freelancers
3 min readApr 9, 2022

One of the most important aspects of networking in Linux Administration. The Linux administrator’s job is to install and manage Linux servers, backups, disaster recovery, help other staff with technical issues, etc

In this blog series, I am going to cover the following topics of Linux administration

i) User account management

ii) Routing and networking

iii) automation with Linux [ for backups & recovery, monitoring, etc ]

Prerequisites: Basic understanding of Linux and terminal commands.

Lab: for this blog series, I am going to use parrot security os, but you can use any Debian-based Linux OS.

CREATING NEW USERS IN LINUX: when we install any Linux os, we need to create a user, by default the user we had created while installing the os will have sudo privileges since that user will be a member of sudo group.

hackpeas

as you can see, currently I have only one user boxlogin, now I am going to create a new user “hackpeas” .

to create new user I can use below commands:

Setting home directory

$ sudo useradd -m hackpeas 

# if we don’t specify -m , then the home directory will not be created for the user

the above command will create a user hackpeas, and also create a directory for user hackpeas in /home , but say if you don’t want to create the user directory in /home and want to create somewhere else say /opt/users/ , then you can do that by specifying argument “d” in useradd command

$ sudo useradd -m -d /opt/users/hackpeas hackpeas

in my case, I don’t change the location of the user directory so I will go with the first command.

$ sudo useradd -m hackpeas

Setting the default shell

for my new user “hackpeas”, I want it to have the default shell to be “zsh”, so I will use which command to check zsh location

hackpeas , Viraj Vaishnav

now to set the shell, use argument “s”

$ sudo useradd -m -s /usr/bin/zsh hackpeas

Comment for user

this comment is going to be shown on login screen

$sudo useradd -m -s /usr/bin/zsh -c “for something great” hackpeas

Setting password for user

the user is created and we can also see the home directory for the user in /home

the last step is to set up password for user hackpeas

$ sudo passwd hackpeas

with this, you have successfully created your user in Linux.

For more CTFs and bug bounty writeup, or content related to ethical hacking, android penetration testing. follow me on:

Youtube: https://www.youtube.com/channel/UC17W_Ircv7EmIIdbJeOQ_BQ
Instagram: https://www.instagram.com/hackpeas/
Linkedin: https://www.linkedin.com/in/viraj-vaishnav-19b0a61aa/
Twitter: https://twitter.com/VirajVaishnav16

Thank You..

--

--

HackPeas Freelancers

We provide the best technical services on a reasonable budget