LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-14-2007, 12:37 PM   #1
fw12
Member
 
Registered: Mar 2006
Distribution: Fedora core, Ubuntu
Posts: 175

Rep: Reputation: 31
About su superuser


I need to understand how "su" works.

I logged into my server via ssh using an ordinary account - reg_user.

To become root, I then issue the command:

[reg_user@my_ip_address ~]$ su

This asked me for a password, which I provided. Now prompt changed to:

[root@my_ip_address reg_user]#

Because of the # sign, I'm assuming at this point that I've become root.

Well, when Issue a command such as:

[root@my_ip_address reg_user]# service iptables start

I get the error:
bash: service: command not found

However, when I login to via ssh directly as root, the command works fine.

What am I doing wrong?
 
Old 08-14-2007, 12:42 PM   #2
cgjones
Member
 
Registered: Nov 2005
Location: Central New York
Distribution: Ubuntu
Posts: 405

Rep: Reputation: 31
Try using one of the following commands:
Code:
su -
Code:
su -l
Code:
su --login
From the su man page:
Quote:
-, -l, --login

Provide an environment similar to what the user would expect had the user logged in directly.

When - is used, it must be specified as the last su option. The other forms (-l and --login) do not have this restriction.
 
Old 08-14-2007, 12:58 PM   #3
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Your $PATH is wrong. Do as the above poster said.
 
Old 08-14-2007, 02:23 PM   #4
fw12
Member
 
Registered: Mar 2006
Distribution: Fedora core, Ubuntu
Posts: 175

Original Poster
Rep: Reputation: 31
Thank you. su - worked fine.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Superuser sakuya84 Linux - Security 2 07-15-2007 09:56 PM
superuser/root zao Linux - General 3 05-02-2006 02:02 AM
Mysql and superuser kuplo Linux - Software 1 12-06-2005 09:00 AM
Superuser CJ_Grobler Linux - Newbie 7 06-13-2005 09:35 PM
superuser snu *BSD 5 07-22-2003 09:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

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