LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-21-2010, 10:24 AM   #1
Morgandy
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
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

Rep: Reputation: 79
Quote:
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:
Code:
export PS1="[\u@\h:\w]\$"
Quote:
-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.
Quote:
-Does service ssh restart disconnect users?
Users connected via ssh, yes, definitely.
 
Old 01-21-2010, 10:48 AM   #3
sarum1990
Member
 
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
portamenteff
Member
 
Registered: Feb 2006
Location: Colorado
Distribution: sabayon
Posts: 178
Blog Entries: 1

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

Morgandy,
The default prompt comes from the PS1 environment variable. You could do set this in this way:
Code:
su
(enter password:)
PS1=\u@\w\h
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:
Code:
chmod u+x /home/john/shellPrompt
./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
Code:
u@wh#
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
Code:
sudo gedit fileName
but I generally use vi for root editing.
Code:
SU
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
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,311

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

su -

gives you root's env

su

(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
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,081
Blog Entries: 52

Rep: Reputation: Disabled
Quote:
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:
In KDE:
Code:
kdesu kwrite whatever file name
In Gnome:
Code:
gksu gedit whatever file name
Followed in both cases with root's password.
 
  


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
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


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration