Wednesday, January 24, 2024

Linux Command Line Hackery Series - Part 6


Welcome back to Linux Command Line Hackery series, I hope you've enjoyed this series so far and would have learned something (at least a bit). Today we're going to get into user management, that is we are going to learn commands that will help us add and remove users and groups. So bring it on...

Before we get into adding new users to our system lets first talk about a command that will be useful if you are a non-root user.

Command: sudo
Syntax: sudo [options] command
Description: sudo allows a permitted user to execute a command as a superuser or another user.

Since the commands to follow need root privileges, if you are not root then don't forget to prefix these commands with sudo command. And yes you'll need to enter the root password in order to execute any command with sudo as root.

Command: useradd
Syntax: useradd [options] username
Description: this command is used for creating new user but is kinda old school.
Lets try to add a new user to our box.
[Note: I'm performing these commands as root user, you'll need root privileges to add a new user to your box. If you aren't root then you can try these commands by prefixing the sudo command at the very beginning of these command like this sudo useradd joe. You'll be prompted for your root password, enter it and you're good to go]

useradd joe

To verify that this command has really added a user to our box we can look at three files that store a users data on a Linux box, which are:

/etc/passwd -> this file stores information about a user separated by colons in this manner, first is login name, then in past there used to be an encrypted password hash at the second place however since the password hashes were moved to shadow file now it has a cross (x) there, then there is user id, after it is the user's group id, following it is a comment field, then the next field contains users home directory, and at last is the login shell of the user.

/etc/group  -> this file stores information about groups, that is id of the group and to which group an user belongs.

/etc/shadow -> this file stores the encrypted password of users.

Using our command line techniques we learned so far lets check out these files and verify if our user has been created:

cat /etc/passwd /etc/group /etc/shadow | grep joe



In the above screenshot you can notice an ! in the /etc/shadow, this means the password of this user has not been set yet. That means we have to set the password of user joe manually, lets do just that.

Command: passwd
Syntax: passwd [options] [username]
Description: this command is used to change the password of user accounts.
Note that this command needs root privileges. So if you are not root then prefix this command with sudo.

passwd joe



After typing this command, you'll be prompted password and then for verifying your password. The password won't show up on the terminal.
Now joe's account is up and running with a password.

The useradd command is a old school command, lets create a new user with a different command which is kinda interactive.

Command: adduser
Syntax: adduser [options] user
Description: adduser command adds a user to the system. It is more friendly front-end to the useradd command.

So lets create a new user with adduser.

adduser jane



as seen in the image it prompts for password, full name and many other things and thus is easy to use.

OK now we know how to create a user its time to create a group which is very easy.

Command: addgroup
Syntax: addgroup [options] groupname
Description: This command is used to create a new group or add an existing user to an existing group.

We create a new group like this

addgroup grownups



So now we have a group called grownups, you can verify it by looking at /etc/group file.
Since joe is not a grownup user yet but jane is we'll add jane to grownups group like this:

addgroup jane grownups



Now jane is the member of grownups.

Its time to learn how to remove a user from our system and how to remove a group from the system, lets get straight to that.

Command: deluser
Syntax: deluser [options] username
Description: remove a user from system.

Lets remove joe from our system

deluser joe

Yes its as easy as that. But remember by default deluser will remove the user without removing the home directory or any other files owned by the user. Removing the home directory can be achieved by using the --remove-home option.

deluser jane --remove-home

Also the --remove-all-files option removes all the files from the system owned by the user (better watch-out). And to create a backup of all the files before deleting use the --backup option.

We don't need grownups group so lets remove it.

Command: delgroup
Syntax: delgroup [options] groupname
Description: remove a group from the system.

To remove grownups group just type:

delgroup grownups



That's it for today hope you got something in your head.
More articles

OVER $60 MILLION WORTH OF BITCOINS HACKED FROM NICEHASH EXCHANGE

Over $60 Million Worth of Bitcoins Hacked from NiceHash Exchange. Bitcoin mining platform and exchange NiceHash has been hacked, leaving investors short of close to $68 million in BTC.
As the price of Bitcoin continues to rocket, surging past the $14,500 mark at the time of writing, cyberattackers have once again begun hunting for a fresh target to cash in on in this lucrative industry.
Banks and financial institutions have long cautioned that the volatility of Bitcoin and other cryptocurrency makes it a risky investment, but for successful attackers, the industry potentially provides a quick method to get rich — much to the frustration of investors.
Unfortunately, it seems that one such criminal has gone down this path, compromising NiceHash servers and clearing the company out.
In a press release posted on Reddit, on Wednesday, NiceHash said that all operations will stop for the next 24 hours after their "payment system was compromised and the contents of the NiceHash Bitcoin wallet have been stolen."
NiceHash said it was working to "verify" the precise amount of BTC stolen, but according to a wallet which allegedly belongs to the attacker — traceable through the blockchain — 4,736.42 BTC was stolen, which at current pricing equates to $67,867,781.
"Clearly, this is a matter of deep concern and we are working hard to rectify the matter in the coming days," NiceHash says. "In addition to undertaking our own investigation, the incident has been reported to the relevant authorities and law enforcement and we are co-operating with them as a matter of urgency."
"We are fully committed to restoring the NiceHash service with the highest security measures at the earliest opportunity," the trading platform added.
The company has also asked users to change their online passwords as a precaution. NiceHash says the "full scope" of the incident is unknown.
"We are truly sorry for any inconvenience that this may have caused and are committing every resource towards solving this issue as soon as possible," the company added.
Inconvenience is an understatement — especially as so much was left in a single wallet — but the moment those coins shift, we may know more about the fate of the stolen investor funds.

Related links


  1. Hack Tools Mac
  2. Bluetooth Hacking Tools Kali
  3. Pentest Tools Github
  4. Blackhat Hacker Tools
  5. Underground Hacker Sites
  6. Hacker Tools For Pc
  7. Pentest Tools Online
  8. Nsa Hacker Tools
  9. Beginner Hacker Tools
  10. Hacking Tools Windows
  11. Pentest Tools List
  12. How To Install Pentest Tools In Ubuntu
  13. Hacker Tools Apk
  14. Free Pentest Tools For Windows
  15. Hack And Tools
  16. Hack Apps
  17. New Hacker Tools
  18. Hacks And Tools
  19. Hacking Tools For Windows 7
  20. Pentest Tools Find Subdomains
  21. Hacking Tools Kit
  22. Hacking Tools Usb
  23. Game Hacking
  24. Pentest Reporting Tools
  25. Hacking Tools For Kali Linux
  26. Hack Apps
  27. Hacking Tools 2020
  28. Ethical Hacker Tools
  29. Hacking Tools For Kali Linux
  30. Hack Tools Pc
  31. Hacking Tools Free Download
  32. Hacking Apps
  33. Tools Used For Hacking
  34. Physical Pentest Tools
  35. Hacker Tools Free
  36. World No 1 Hacker Software
  37. Pentest Tools Nmap
  38. Pentest Tools Windows
  39. Hackrf Tools
  40. Hacking Tools Pc
  41. Hacking Tools Hardware
  42. Growth Hacker Tools
  43. Hacker Tools Software
  44. Pentest Automation Tools
  45. How To Make Hacking Tools
  46. Hacker Tools 2020
  47. Pentest Tools Kali Linux
  48. Pentest Tools Website Vulnerability
  49. Best Hacking Tools 2020
  50. Android Hack Tools Github
  51. Hack Tools For Windows
  52. Pentest Tools Website Vulnerability
  53. How To Install Pentest Tools In Ubuntu
  54. Easy Hack Tools
  55. Hacker
  56. Best Pentesting Tools 2018
  57. Hacking Tools For Pc
  58. Pentest Tools Open Source
  59. World No 1 Hacker Software
  60. Pentest Tools Kali Linux
  61. Pentest Box Tools Download
  62. How To Make Hacking Tools
  63. Pentest Tools Tcp Port Scanner
  64. Pentest Tools Alternative
  65. Pentest Tools For Ubuntu
  66. Tools For Hacker
  67. Hacker Tools Software
  68. Growth Hacker Tools
  69. Hacking Tools Download
  70. Hacking Tools Hardware
  71. Wifi Hacker Tools For Windows
  72. Hak5 Tools
  73. Hacker Tools 2019
  74. Hacking Tools Github
  75. Hacking Tools For Mac
  76. Pentest Tools Apk
  77. Pentest Tools Url Fuzzer
  78. Hack App
  79. Hacker Tool Kit
  80. Github Hacking Tools
  81. Pentest Tools Download
  82. Pentest Tools Website Vulnerability
  83. Hack Tools Pc
  84. Hacker Tools Apk Download
  85. Hacking Tools 2019
  86. Pentest Tools Kali Linux
  87. Pentest Tools Kali Linux
  88. Pentest Tools Url Fuzzer
  89. Hacking Tools Mac
  90. Pentest Tools For Windows
  91. Pentest Tools Windows
  92. Hacking Tools For Mac
  93. Pentest Tools Subdomain
  94. Pentest Tools For Mac
  95. Hacking Tools Software
  96. Best Pentesting Tools 2018
  97. Pentest Tools Alternative
  98. Hacker Tools Free
  99. Pentest Tools Kali Linux
  100. Computer Hacker
  101. Best Hacking Tools 2019
  102. Pentest Tools Port Scanner
  103. How To Install Pentest Tools In Ubuntu
  104. How To Make Hacking Tools
  105. New Hacker Tools
  106. Pentest Tools
  107. Hack App
  108. Hacker Tools 2019
  109. Hacking Tools Pc
  110. Hacker Tools For Pc
  111. Hack Apps
  112. Hacker Tools Software
  113. Pentest Tools Open Source
  114. Hacking Apps
  115. Hacker Tools Apk
  116. Pentest Tools Framework
  117. Hacking Apps
  118. Hack Tools
  119. Hacker Hardware Tools
  120. Best Hacking Tools 2019
  121. Hacker Tools Online
  122. Hack Rom Tools
  123. Hacker Tools Free
  124. Hacking Apps
  125. Pentest Tools Bluekeep
  126. Usb Pentest Tools
  127. Hacking Tools Hardware
  128. Hack Tools Github
  129. Hacker Tools 2019
  130. Easy Hack Tools
  131. Hackrf Tools
  132. Hacking App
  133. Beginner Hacker Tools
  134. Blackhat Hacker Tools
  135. Physical Pentest Tools
  136. World No 1 Hacker Software
  137. Physical Pentest Tools
  138. Kik Hack Tools
  139. Best Hacking Tools 2019
  140. What Are Hacking Tools

2341 Interesting News