Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-12-2006, 09:45 AM
|
#1
|
LQ Newbie
Registered: May 2004
Location: Istanbul Turkey
Distribution: gentoo
Posts: 2
Rep:
|
su - root problem
Hi,
I was trying to install a program , which creates "on the fly " scripts containing the following line.
/bin/su - username -c "set " > /tmp/env.out
The installation program uses the script to do various environment checks.
When the above command runs "set " via su , it does not detect all the environment variables, su as a shortcut i moved su to su.old and made a new su command containing the lines required by the installation to continue.
But when i moved back su.old to su, I am unable to do
su - root,
It gives
su: Authentication failure
Sorry.
However If I do
sudo su - root
it works . I am using Gentoo with kernel 2.6 (2.6.10-gentoo-r6)
Thks for your help
Ali
|
|
|
01-12-2006, 10:46 AM
|
#2
|
Senior Member
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,508
Rep:
|
I am not sure, but probably you lost the SETUID bit when you copying it around. It must be set as:
-rwsr-xr-x 1 root root 27648 2005-09-10 02:56 /bin/su
The command to set the SETUID bit is "chmod u+s /bin/su".
|
|
|
01-12-2006, 10:53 AM
|
#3
|
LQ Newbie
Registered: May 2004
Location: Istanbul Turkey
Distribution: gentoo
Posts: 2
Original Poster
Rep:
|
Thank you for the help, it worked, now if I go back to my original problem,
a)
/bin/su - username -c "set " > /tmp/env0.out
b)
su - username
set > tmp>env1.out
Why env1.out and env0.out are different ?
Thks
Ali
|
|
|
01-16-2006, 04:59 AM
|
#4
|
Senior Member
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,508
Rep:
|
Because the initialization scripts (profile, bashrc, and others) have conditional statements that detects an interactive shell from a non-interactive one.
For example, in a non-interactive shell you may skip several things that are not used in such shell, things like a full featured prompt, alias commands, history list, and so. A non-interactive shell may be used to read/execute another script shell. Doing this, you save time in initializing such shell and start the script as soon is possible.
This logic may left out some important variable your particular application is in need, so you have to move it from the conditional section to the static/fixed section.
|
|
|
All times are GMT -5. The time now is 05:29 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|