Maybe you are new to this operating system or maybe you already know the Debian basics. When you learn a new computer operating system you feel like learning a new language, not your native, but a foreign one. You may use tutorials, books, documentation, these are very helpful, but without any practice it may be useless. In order to offer you some help we elaborated some basic points regarding the Debian console basics which you may consider useful information, especially if you are getting started now.

First of all, let’s start with the shell prompt. After you login you will be able to use Debian shell prompt, also known as command prompt, which will be displayed in the left side of your monitor. What is its purpose? Well, for the moment it is waiting for you to write some commands there. The welcome message for the shell prompt can be easily customized if you edit the file ‘etc/modt.tail’. So, you are in the shell which will compile your future commands.

You may have installed the X Window System with Gnome (a display manager) you will see the graphic screen at logon. You are logged in now, and if you made this with a super-user or the root account you can do some pretty cool administrative tasks: remove, write and read any file on the system, no matter what their permissions are, set file permissions and ownerships, set passwords for other users on your Debian system or, check this out, you can login to any other account without even knowing the password they use. As you can see there is nothing you cannot do if you are the root user. Be responsible while using this account and never share your password with other people. Stay safe!

If you want to get to the root shell prompt using the root password you can acquire this by:

  • typing ‘root‘ when you are in the basic command prompt
  • typing ‘su -1‘ from any user shell prompt (you will lose your current data)
  • typing ‘su‘ from any shell prompt (keeping some of your current data)

If you finished your job on the current session you can leave the command prompt in Debian typing the keys ‘CTRL + D‘, pressed together, and your shell activity will be done. If you are in the character console this command will get you back to the shell prompt. Other way to leave the prompt is to type ‘exit’ at the command line. When your job is finished and you want to shut down the system from the command line using ‘shutdown -h now’. Instead, if you want to recover a console (maybe after your screen went berserk) you can write ‘reset’ on the shell prompt on Debian.

You are now able to use the Debian operating system without any risk, but make sure to read also the Security Manual from Debian documentation, because you have to use a non privileged user account to stay safe. Of course, you will have to go deep with the shell prompt, but this article offered you an overview which will be helpful for you in the future.

Bash: Check if you are root

Valic —  October 20, 2011 — 1 Comment

Using the following you can check if you are root or not when you run bash scripts.

Exmaple 1:

[php]
#!/bin/bash
if [ $(whoami) != 'root' ]; then
echo "Must be root to run $0"
exit 1;
fi
[/php]

Example 2:

[php]
#!/bin/bash
ROOT_UID=0 # Only users with $UID 0 have root privileges.
E_NOTROOT=87 # Non-root exit error.

if [ "$UID" -ne "$ROOT_UID" ]
then
echo "Must be root to run this script!"
exit $E_NOTROOT
fi
echo "You are root!"
[/php]

You can also use this in your bash scripts.

First, don’t panic! This is usually a simple matter so long as you have physical access to the console.

Simply follow the steps below to boot the system bypassing login, and then set a new password:

Step 1. Reboot the system. Make sure your physically present.

Step 2. When the Grub menu comes up, press “e” to edit the menu selections.

Step 3. Select the kernel you would usually boot and press “e” to edit the settings.

Continue Reading…

Do you want to recover the MySQL root password. its by no means, easy. But its quite simple if you follow the procedure. You will have to follow this step-by-step processes.

  1. Step 1: Stop the MySQL server process.
  2. Step 2: Start the MySQL (mysqld) server/daemon process with the –skip-grant-tables option so that it will not prompt for a password.
  3. Step 3: Connect to the MySQL server as the root user.
  4. Step 4: Set a new root password.
  5. Step 5: Exit and restart the MySQL server.

Here are the commands you need to type for each step (log in as the root user):

Step 1 : Stop the MySQL service:

Continue Reading...

Page 1 of 11