First Commands After Installing Kali Linux
IMPORTANT POINTS TO BE NOTED:
Sudo stands for either “substitute user do” or “super user do”
"root" (aka "superuser") is the name of the system administrator account.
Root user has user id 0 and nominally has unlimited privileges.
Root can access any file, run any program, execute any system call, and modify any setting.
The "sudo" command lets you execute commands with superuser privileges as long as your
user id is in the sudoers file, giving you the necessary authorization.
Enable Root Login and Set Kali Root Password:
Check Login User
whoami
sudo apt update
sudo apt install kali-root-login
Login as Root in the Terminal
sudo -i
Check Login User Again
whoami
Set the Kali Linux Root Password
passwd
exit
Click Log Out
Login as root with its password
User Accounts Management
Create a New Normal User in the terminal
useradd -m username
-m creates a home directory for the user.
Set a password for the user
passwd username
OR
sudo password username
Specify the shell for new user
chsh -s /bin/bash username
Delete a Normal User
sudo deluser username
Delete the user's home directory and its contents
sudo deluser --remove-home username
Grant Sudo Privileges to a Regular or Normal User
sudo usermod -aG sudo username
The option -a means to add and ‘-G sudo’ means to add the user to the sudo group.
OR
usermod -a -G sudo username
To verify a User Added in "sudo" group is Working
Creates a New Folder or Directory "xyz"
sudo mkdir /xyz
Remove Directory or Folder
For Empty folder
rmdir dirname
For Non-Empty folder
rm -r dirname
Remove sudo privileges of a User
sudo deluser username sudo
OR
sudo gpasswd -d username sudo
Verify the user "username" has been really removed from sudo group using command:
sudo -l -U username
FIND USER ACCOUNT INFO:
1. id Command
id is a simple command line utility for displaying a real and effective user and group IDs.
id username
2. groups Command
groups command is used to show all the groups a user belongs to like this.
groups username
3. lslogins Command
lslogins command shows information about known users in the system.
-u flag only displays user accounts.
lslogins -u
4. users Command
users command shows the usernames of all users currently logged on the system.
users
5. who Command
who command is used to display users who are logged on the system.
Including the terminals they are connecting from.
who -u
6. w Command
w command shows all users who are logged on the system and what they are doing.
w
7. last or lastb commands
last/lastb commands displays a list of last logged in users on the system.
last
last -a
last -ap now
-a show host name on the last column
-p show all users present at a specified time
8. lastlog Command
lastlog command is used to find the details of a recent login of all users or of a given user.
lastlog
lastlog -u username
-u show lastlog records for a specific user
- Get link
- Other Apps
Comments
Post a Comment