LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

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


Hi

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 09:28 AM.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 01-17-2011, 09:21 AM   #2
EDDY1
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, 09:28 AM   #3
Soadyheid
Senior Member
 
Registered: Aug 2010
Location: Near Edinburgh, Scotland
Distribution: Cinnamon Mint 17.3 and 18.2 at present.
Posts: 1,295

Rep: Reputation: 301Reputation: 301Reputation: 301Reputation: 301
Quote:
NAME
su - change user ID or become superuser

SYNOPSIS
su [options] [username]

DESCRIPTION
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, 09:32 AM   #4
Soji Antony
Member
 
Registered: Jul 2010
Posts: 54

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

Quote:
When issuing this command:

$ ssh joseph@howto.admon.org ‘uptime’

you will gain a non-login shell at the remote side howto.admon.org.

however

$ ssh joseph@howto.admon.org yields a login shell ...
 
Old 01-17-2011, 09:32 AM   #5
stress_junkie
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.
Code:
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 ----------

Quote:
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, 09:40 AM   #6
Soji Antony
Member
 
Registered: Jul 2010
Posts: 54

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

Rep: Reputation: Disabled
"1.2.2.2.1. 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:

/etc/profile

~/.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.
1.2.2.2.2. 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 (...) "

http://tldp.org/LDP/Bash-Beginners-G...ect_01_02.html

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


Reply


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 06:35 AM
How to configure auto login & after login auto startup some program. hocheetiong Linux - Newbie 1 02-18-2008 01:49 AM
How do I login to the terminal as someone else? ChrisR(SQL DBA) Linux - Newbie 2 11-10-2006 04:22 PM
difference between root login and su? st1cky_rice Linux - Newbie 17 12-12-2005 08:40 PM
Cannot login@terminal gk_ Slackware 4 08-06-2004 06:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:23 AM.

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