Access super user shell

I recently had a problem with my Debian box; namely, that I couldn’t access my superuser shell the usual way by typing:

As this is a problem with the user bit of the “su” command not being set properly, you can fix this by logging in as root (or any other user with superuser privileges) and type:

I hope this saves someone’s time out there 😉

Using Linux Shell to Add a User

Hiya all. As I continued to work with my remote server’s shell, a new issue arose. I needed to add a new user to my system.

So, suppose that you want to add Mr. Friend to your system via bash:

Okay, now you need to set a password for our friend:

You will be prompted to enter the password and confirm it.

However, to do all this you need to be root. To do so, before entering any of these, type:

Don’t forget the ““, because otherwise you will get a “command not found” when you issue “useradd”.

Note: On some systems the command is “adduser” instead of “useradd”.

Kill users in Linux shell

Okay, first off, this is not a tutorial to show you how to kill your nemesis. For that, you need to take shooting lessons (or maybe, learn how to mix poisons).

Killing here means logging out a user. This can be particularly useful if somebody has logged into your PC whom you don’t want to have access. Or whom you simply don’t like.

For instance, if you are managing a server, and a particular user is eating up all the bandwidth and also won’t listen to reason, you can just log him out. Simple as that.

There’s a good set of utilities called “procps” which might come handy. It contains a tool called “skill” which helps you send signals and such to users and other active (or inactive) processes.

Okay, enough talk. Let’s send some cool signals.

The syntax of the skill command looks like this:

There are a possible number of signals you can send. And obviously, you will be sending those signals to the user with username “USERNAME”.

Signals to send to users

You can send these different signals to users:

  • stop; which means you want that user’s activities to be halted. It’s like pushing the “Pause” button on a video set.
  • cont; is the resume button, whereas “stop” was the pause. You can use “cont” to allow the user to continue with his/her activities.
  • kill; now, this sounds like something the Dark Lord would have loved. You send the “kill” signal, the user’s session ends.

Example: Logging out “mr-enemy”

Okay, suppose your enemy – with the convenient user name “mr-enemy” – has logged into your system, and you want to log him out, just to spite him.

Here’s what you do:

Easy, no? You can also halt his session to irk him some more:

More Information

One thing to note, is that to stop a user you have to be “root”. More information on the skill command can be found by typing into your shell:

There, you will (probably) see that it is a deprecated command. However, I myself couldn’t find a replacement.

Other useful commands from the procps package include: top, kill, w, free, and vmstat.

Tired of your life?

No problem, you can even commit suicide with Linux shell:

where [yourusername] is replaced with your user name (surprise!).

Note: NEVER kill the “root” if you don’t want to cold reboot your system!