Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-17-2011, 08:19 AM   #1
Soji Antony
Registered: Jul 2010
Posts: 54

Rep: Reputation: 1
Difference between a login terminal & non-login termiinal


Can some one tell me the difference b/w a login shell and a non-login shell ?

I know that when we use su - <username> we are getting a login shell & when we use su <user-name> we are getting a non-login shell.

Do we get any additional privileges when we have a login shell compared to a non-login shell ?

Thanks in advance ...

Last edited by Soji Antony; 01-17-2011 at 08:28 AM.
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 01-17-2011, 08:21 AM   #2
LQ Addict
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,838

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
If you're talking about remote terminal you should have login (password).
1 members found this post helpful.
Old 01-17-2011, 08:28 AM   #3
Senior Member
Registered: Aug 2010
Location: Near Edinburgh, Scotland
Distribution: Cinnamon Mint 17.3 and 18 at present.
Posts: 1,244

Rep: Reputation: 266Reputation: 266Reputation: 266
su - change user ID or become superuser

su [options] [username]

The su command is used to become another user during a login session.
Invoked without a username, su defaults to becoming the superuser. The
optional argument - may be used to provide an environment similar to
what the user would expect had the user logged in directly.
From the "su" man page. Any use?

Play Bonny!
1 members found this post helpful.
Old 01-17-2011, 08:32 AM   #4
Soji Antony
Registered: Jul 2010
Posts: 54

Original Poster
Rep: Reputation: 1
I read this some where

When issuing this command:

$ ssh ‘uptime’

you will gain a non-login shell at the remote side


$ ssh yields a login shell ...
Old 01-17-2011, 08:32 AM   #5
Senior Member
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
The difference between using su - and su is explained (somewhat) in the manual page for su.
man su
However it is not entirely clear.

When you use the su command with the - parameter then after you successfully enter the new user's password your process will execute the same scripts as if you had logged on to that user account in a console terminal. If you do not use the - parameter then you will not execute the login scripts.

The result of not executing the login scripts are that
1) you will have the same current working directory as before you executed the su command
2) you will have the same environment variable values as before you executed the su command
3) you will not execute any commands in their $HOME/.bash_profile and other user specific login commands

If you do use the - parameter when executing su then
1) you will have the HOME directory of the user as your current working directory
2) you will have the same environment variables as if the user had logged in from a console terminal
3) you will also execute any commands in their $HOME/.bash_profile and other user specific login commands

---------- Post added 01-17-11 at 09:33 AM ----------

Originally Posted by Soji Antony View Post
I read this some where
Here I think you are confusing the word "shell" with the word "prompt". They are entirely different.
3 members found this post helpful.
Old 01-17-2011, 08:40 AM   #6
Soji Antony
Registered: Jul 2010
Posts: 54

Original Poster
Rep: Reputation: 1
Thank you so much ...
Old 06-26-2011, 09:07 AM   #7
LQ Newbie
Registered: Jun 2011
Posts: 7

Rep: Reputation: Disabled
" Invoked as an interactive login shell, or with `--login'

Interactive means you can enter commands. The shell is not running because a script has been activated. A login shell means that you got the shell after authenticating to the system, usually by giving your user name and password.

Files read:


~/.bash_profile, ~/.bash_login or ~/.profile: first existing readable file is read

~/.bash_logout upon logout

Error messages are printed if configuration files exist but are not readable. If a file does not exist, bash searches for the next. Invoked as an interactive non-login shell

A non-login shell means that you did not have to authenticate to the system. For instance, when you open a terminal using an icon, or a menu item, that is a non-login shell.

Files read:

~/.bashrc (...) "

Last edited by t_shit; 06-26-2011 at 09:08 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to disable "last login log" & disable "last login message" when start login. hocheetiong Linux - Newbie 4 02-08-2011 05:35 AM
How to configure auto login & after login auto startup some program. hocheetiong Linux - Newbie 1 02-18-2008 12:49 AM
How do I login to the terminal as someone else? ChrisR(SQL DBA) Linux - Newbie 2 11-10-2006 03:22 PM
difference between root login and su? st1cky_rice Linux - Newbie 17 12-12-2005 07:40 PM
Cannot login@terminal gk_ Slackware 4 08-06-2004 05:24 PM

All times are GMT -5. The time now is 04:40 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration