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-21-2010, 10:24 AM   #1
LQ Newbie
Registered: Dec 2009
Location: Cleveland
Posts: 16

Rep: Reputation: 0
Exclamation Multiple Questions - can't find answers anywhere

Hi All,

I need the following information:

- When using SU - , I need the option to show the full user path (root user, home dir, etc..), not just root@name. Is there one?

-If not in sudoers file, how can a user get in to edit a file for example. Is that possible?

-Does service ssh restart disconnect users?

Thanks greatly!

Last edited by Morgandy; 01-21-2010 at 10:26 AM.
Old 01-21-2010, 10:44 AM   #2
Senior Member
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Originally Posted by Morgandy View Post
- When using SU - , I need the option to show the full user path (root user, home dir, etc..), not just root@name. Is there one?
You can use the PS1 environment variable in ~/.bashrc
edit ~/.bashrc and add the folling line at the end:
export PS1="[\u@\h:\w]\$"
-If not in sudoers file, how can a user get in to edit a file for example. Is that possible?
With a text editor, like gedit, vi, or emacs. Why do you need the sudoers file to edit a file anyway? Do you mean to edit a file you don't have the right to edit? Just give the user the right to edit and he can edit.
-Does service ssh restart disconnect users?
Users connected via ssh, yes, definitely.
Old 01-21-2010, 10:48 AM   #3
Registered: Dec 2008
Distribution: Gentoo, Debian
Posts: 31

Rep: Reputation: 21
In regards to your first question I believe you should look at the man page for whatever shell you are using under prompting. For instance in BASH you can change the prompt by setting $PS1 to different things.

If a user is not in the sudoers file they can su root if they have the root password to switch to the root user and perform administrative tasks requiring such privileges.

Restarting ssh will disconnect users.

Hope this helps.
Old 01-21-2010, 11:21 AM   #4
Registered: Feb 2006
Location: Colorado
Distribution: lubuntu, fedora, lightning Linux.
Posts: 180
Blog Entries: 1

Rep: Reputation: 36
answers (or some of them)

The default prompt comes from the PS1 environment variable. You could do set this in this way:
(enter password:)
export $PS1
echo $PS1
The PS1 is an environment variable. This is a temporary fix. If you want to change it permanently, you need to (as root) open /etc/profile and find the part of this shell program that defines PS1. I don't recommend this for newer users. You can paste this code into a .txt file and put in an easily accessible directory and just run it whenever you want to use this prompt. This is how I do it. I simply type:
chmod u+x /home/john/shellPrompt
because that's what I named the thing. (note once you set permission will chmod it will stay that way until you change it.
Up there in the line that starts with "PS1", is a "\u" for user, "@" which is a string, "\w" working directory, "\h" for hostname. You can leave the h out if you want or add "\t", "\d" date and time. The "\" is nessecary as an escape character. If you don't put the \ in there your prompt will look like this
Nice huh? I learned this the hard way so you won't have to.

As to the SU question, you can edit any file that you have permission to, unless you have the root password, then you can edit any file on the machine!
I do use "sudo" occasionally, but SU is better because you don't have to type "sudo" every time you want permission, there is no limit to SU's permission.
If I want to edit a file in a graphical text editor I type
sudo gedit fileName
but I generally use vi for root editing.
vi fileName
As for the SSH question: No. If the connection times out, the client will have to log in again. It's not that much of a task, so I never complained about it. Remember to always save your work. Save it early, and often.
Hope that helps.
Old 01-21-2010, 06:11 PM   #5
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,569

Rep: Reputation: 2426Reputation: 2426Reputation: 2426Reputation: 2426Reputation: 2426Reputation: 2426Reputation: 2426Reputation: 2426Reputation: 2426Reputation: 2426Reputation: 2426
Note that Linux is case sensitive, so the cmd is su not SU.

su -

gives you root's env


(no '-') logs you in as root, BUT with your orig env...

Actually, you can switch to any user via su, if you know the passwd. It just defaults to root if you don't specify one.
Old 01-21-2010, 07:30 PM   #6
LQ 5k Club
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.2
Posts: 7,808
Blog Entries: 58

Rep: Reputation: Disabled
Originally Posted by Morgandy View Post
-If not in sudoers file, how can a user get in to edit a file for example. Is that possible?
Two examples:
kdesu kwrite whatever file name
In Gnome:
gksu gedit whatever file name
Followed in both cases with root's password.


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
Why don't my questions get answers? SaintDanBert LQ Suggestions & Feedback 22 09-30-2009 12:17 AM
can some one tell me the answers to these questions thanks pretorian Linux - Newbie 2 04-19-2009 11:03 PM
I've got questions, you got answers? cynicalpsycho Linux - Newbie 16 03-20-2009 08:57 AM
need some help,i need answers for these questions please.. chidipudi Linux - Newbie 5 07-16-2008 01:08 PM
well... some questions looking for answers murshed Linux - General 13 01-16-2003 09:42 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:02 AM.

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