LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 09: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 09:26 AM.
 
Old 01-21-2010, 09:44 AM   #2
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,596

Rep: Reputation: 80
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, 09: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, 10:21 AM   #4
portamenteff
Member
 
Registered: Feb 2006
Location: Colorado
Distribution: lubuntu, fedora, lightning Linux.
Posts: 180
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, 05:11 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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, 06:30 PM   #6
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,298
Blog Entries: 61

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



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-29-2009 11:17 PM
can some one tell me the answers to these questions thanks pretorian Linux - Newbie 2 04-19-2009 10:03 PM
I've got questions, you got answers? cynicalpsycho Linux - Newbie 16 03-20-2009 07:57 AM
need some help,i need answers for these questions please.. chidipudi Linux - Newbie 5 07-16-2008 12:08 PM
well... some questions looking for answers murshed Linux - General 13 01-16-2003 08:42 AM

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

All times are GMT -5. The time now is 09:58 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
Open Source Consulting | Domain Registration