Thursday, May 26, 2011

Logging into a Linux System

In Linux system we should remember that 'root' is the superuser.

We can log in to the root by giving following information

Login User:root

Password: Will be the password given at the time of installation

To log in to sub-user we can either log in to other virtual console or can switch in the same console using 'su' command.

Eg: Consider that you have logged in as root in console 1 (tty1) . Now you have to log in  as a sub user (Eg: student1)

If you want to login in other console 2, then press 'CTRL+ALT+F2'. You will get a shell prompt asking for username and password.

If you want to log in to sub user (student1) in same console 1 then there are 2 types of log in.

1. Log in by changing your current working directory

2. Log in without changing your current working directory

- Log in by changing your current working directory

Consider that you are logged in as root and your working directory will be root and you want to switch to user 'student1'. Then you have to use the following command

su - student1

Now you are logged in as 'student1' and your current working directory will be home (~)  folder of 'student1'.

Note: Since you are switching from 'root' to 'student1' the shell prompt will not ask for password to log in since root will be having full permission to access other users. However if you want to switch from subuser  to other subuser or root (eg student1 to student2) shell prompt will be asking for password to log in.

- Log in without changing your current working directory

Consider that you are logged in as root and your working directory will be root and you want to switch to user 'student1'. Then you have to use the following command

su  student1

Now you are logged in as 'student1' ,  however your current working directory will be unchanged that is it will be root folder

No comments:

Post a Comment

Powered By Blogger

Followers