LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 01-12-2006, 09:45 AM   #1
alimutlu
LQ Newbie
 
Registered: May 2004
Location: Istanbul Turkey
Distribution: gentoo
Posts: 2

Rep: Reputation: 0
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
 
Old 01-12-2006, 10:46 AM   #2
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,508
Blog Entries: 2

Rep: Reputation: 68
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".
 
Old 01-12-2006, 10:53 AM   #3
alimutlu
LQ Newbie
 
Registered: May 2004
Location: Istanbul Turkey
Distribution: gentoo
Posts: 2

Original Poster
Rep: Reputation: 0
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
 
Old 01-16-2006, 04:59 AM   #4
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,508
Blog Entries: 2

Rep: Reputation: 68
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.
 
  


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
Root problem Daniboy Linux - Software 2 10-08-2005 02:44 AM
Root Problem Centinul Fedora 1 06-20-2005 11:08 AM
root problem phatbastard Slackware 3 12-01-2004 10:28 AM
root files: create as root:root or root:wheel? pcass Linux - Security 1 02-07-2004 04:14 PM
Root problem chamkila Linux - Security 2 11-21-2001 09:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 05:29 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