LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 04-06-2005, 09:29 PM   #1
lazyboy0001
Member
 
Registered: Mar 2004
Posts: 31

Rep: Reputation: 15
su problem in slack 10.1


There are some problems when I su to root:

1. when I work as root using "su", the prompt is not "#" but a "$" as the normal user.

2.
$ su (type in the root passwd)
$ touch aaa ( generate a file named aaa)
$ ls -l aaa
-rw-r--r-- 1 root root 0 2005-04-06 22:21 aaa
$ exit ( exit from root to normal user)
$ rm aaa
rm: remove write-protected regular empty file `aaa'? y
$ ls aaa
ls: aaa: No such file or directory ( the file is removed )
$

3. for a file foo.tar.gz
when I extract it using: tar zxvf foo.tar.gz
and then: ls -l
the owner of the extracted files are one of the normal users in my computer
but not root

Anybody can give me any hint about what is wrong with my system?

OS: slackware 10.1
fs type of /home: ext3
 
Old 04-06-2005, 09:37 PM   #2
subekk0
Member
 
Registered: Sep 2003
Location: Dallas, TX.
Distribution: Slacking since '94
Posts: 153

Rep: Reputation: 32
do a quick little test..... log out and then actually log in as root. Create a file then log out and log in as a user and su to root then try to do something with the file. If you are getting errors there then I would check the /etc/groups file and make sure that it didn't get hosed. Also check the owner of home.
 
Old 04-06-2005, 10:46 PM   #3
lazyboy0001
Member
 
Registered: Mar 2004
Posts: 31

Original Poster
Rep: Reputation: 15
Originally posted by subekk0
%% do a quick little test..... log out and then actually log in as root.
That is a remote computer. I can't remote login as root.

%% Create a file then log out and log in as a user and su to root then try to do something with the file.
Fortunately, there is previously a loadlin16c.txt file in /root, which is generated when the system was first installed. And it is write only to root. I can modify the file with no problem when su.

%%If you are getting errors there then I would check the /etc/groups file and make sure that it didn't get hosed.
no error at all.

%%Also check the owner of home.
Following is " ls -l " result for home:
drwxr-xr-x 16 root root 4096 2004-06-07 16:32 home

Any more hint? Thanks.
 
Old 04-07-2005, 12:16 AM   #4
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 51
I would check your /etc/fstab to see if you're not setting a "default" user when creating a file.
 
Old 04-07-2005, 01:04 AM   #5
lazyboy0001
Member
 
Registered: Mar 2004
Posts: 31

Original Poster
Rep: Reputation: 15
My /etc/fstab:

/dev/hda5 swap swap defaults 0 0
/dev/hda1 / reiserfs defaults 1 1
/dev/hda6 /home ext3 defaults 1 2
/dev/hda8 /opt ext3 defaults 1 2
/dev/cdrom /mnt/cdrom iso9660 noauto,user,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0
/dev/hdb1 /home/hdb1 reiserfs noauto,user,exec 0 0
/dev/hdb2 /home/hdb2 vfat noauto,user,exec 0 0
/dev/hdb3 /home/hdb3 vfat noauto,user,exec 0 0
 
Old 04-07-2005, 01:32 AM   #6
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 51
Did you used those commands in hdb2 or hdb3?
Did you tried again in different points and with other users?

Last edited by gbonvehi; 04-07-2005 at 01:38 AM.
 
Old 04-07-2005, 07:45 AM   #7
lazyboy0001
Member
 
Registered: Mar 2004
Posts: 31

Original Poster
Rep: Reputation: 15
I used thoes commands in my home directory.
I just tried to "su" from another user, it has the same problem.
 
Old 04-07-2005, 08:09 AM   #8
lazyboy0001
Member
 
Registered: Mar 2004
Posts: 31

Original Poster
Rep: Reputation: 15
I found the problem for "su" root showing "$" but not "#" prompt. It is because that I set "PS1" in my .bashrc file. When I get rid of it, it works just fine.
However, the normal user can still delete root's file in normal user's home directory. When root extract *.tar.gz, the extracted files will still be owned not by root but a normal user ( may not be the same that doing "su")
 
Old 04-07-2005, 08:46 AM   #9
Nobber
Member
 
Registered: Jun 2002
Location: Nova Scotia
Distribution: Debian (home), Kubuntu 7.04 (work)
Posts: 265

Rep: Reputation: 30
Maybe I'm missing something, but I don't see anything wrong with the behaviour in (2) and (3).

If a directory belongs to you (a normal user), you should be able to change it (i.e. its contents), and that means being able to remove any files it contains (regardless of who owns them).

When root extracts a tarball, it will set ownership and permissions of the extracted files to those defined in the tarball itself. However, when you extract a tarball as a normal user, the files will typically belong to you because you do not have permission to "chown" them to somebody else.
 
Old 04-07-2005, 08:55 AM   #10
subekk0
Member
 
Registered: Sep 2003
Location: Dallas, TX.
Distribution: Slacking since '94
Posts: 153

Rep: Reputation: 32
Quote:
Originally posted by lazyboy0001
[B]Originally posted by subekk0
%% do a quick little test..... log out and then actually log in as root.
That is a remote computer. I can't remote login as root.
Well, now I am confused. You can su to root but you can't login as root? Is this a computer that is shared that via the Web that you have shell access to and a "virtual server" that you are root of? If that is the case it might be a problem with how the virtual server was setup? Generally if you can su to root you can log in as root.
 
Old 04-07-2005, 09:43 AM   #11
lazyboy0001
Member
 
Registered: Mar 2004
Posts: 31

Original Poster
Rep: Reputation: 15
Originally posted by Nobber
Maybe I'm missing something, but I don't see anything wrong with the behaviour in (2) and (3).

If a directory belongs to you (a normal user), you should be able to change it (i.e. its contents), and that means being able to remove any files it contains (regardless of who owns them).


I was just afraid that was some security or setting-up problem. It seems that what you said is quite possible. Can anyone please check if you have the same problem on your computer? If there are other systems act the same way, I won't worry about that any more.

When root extracts a tarball, it will set ownership and permissions of the extracted files to those defined in the tarball itself. However, when you extract a tarball as a normal user, the files will typically belong to you because you do not have permission to "chown" them to somebody else.

The problem for extraction of tarball is that the tarball file is a downloaded software package but not one generated by myself.
 
Old 04-07-2005, 09:55 AM   #12
Nobber
Member
 
Registered: Jun 2002
Location: Nova Scotia
Distribution: Debian (home), Kubuntu 7.04 (work)
Posts: 265

Rep: Reputation: 30
Quote:
Originally posted by lazyboy0001
The problem for extraction of tarball is that the tarball file is a downloaded software package but not one generated by myself.
I usually do a "chown -R 0:0 directory" on a tarball extracted as root - this is quite normal. There's also a tar option for setting default ownership on extracted files (when operating as root): --no-same-owner.
 
Old 04-07-2005, 09:57 AM   #13
lazyboy0001
Member
 
Registered: Mar 2004
Posts: 31

Original Poster
Rep: Reputation: 15
Originally posted by subekk0
Well, now I am confused. You can su to root but you can't login as root? Is this a computer that is shared that via the Web that you have shell access to and a "virtual server" that you are root of? If that is the case it might be a problem with how the virtual server was setup? Generally if you can su to root you can log in as root.

Since the remote-login-as-root is disabled. I just enabled that and the same problem occurs, i.e., extracted tarball has the permission of a normal user, and root generated file in normal users home directory can be deleted by that user.
 
Old 04-07-2005, 10:13 AM   #14
lazyboy0001
Member
 
Registered: Mar 2004
Posts: 31

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by Nobber
I usually do a "chown -R 0:0 directory" on a tarball extracted as root - this is quite normal. There's also a tar option for setting default ownership on extracted files (when operating as root): --no-same-owner.
Thanks. I feel better now for tarball if it is normal.


I just noticed another quite interesting thing. Suppose I am userA. In my home directory, there are two files not belong to me, one is to root with permission -rw-r--r-- and the other one belongs to userB with permission -rw-r--r--. I can delete the one owned by root but can't delete the one owned by uerB with the error "Permission denied". Does that mean normal user's file is better protected thatn root? I can't believe it.
 
Old 04-07-2005, 10:19 AM   #15
lazyboy0001
Member
 
Registered: Mar 2004
Posts: 31

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by Nobber
If a directory belongs to you (a normal user), you should be able to change it (i.e. its contents), and that means being able to remove any files it contains (regardless of who owns them).
I can't agree with you for this point now. Just as in my last post, I can remove files owned by root but can't remove files owned by another normal user (all files are in my home directory of course).
 
  


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
Problem with Slack 10.1 Lintux Slackware 17 02-11-2005 08:05 AM
Slack problem... TCasp77 Linux - Networking 1 02-27-2004 06:13 PM
Slack problem Coldhg Slackware 6 10-27-2003 02:51 PM
SBLive problem in Slack 8.1 Flat_Tire_ Slackware 12 03-07-2003 10:22 PM
Slack 8.1 problem DigitalKhaos Linux - Newbie 3 02-09-2003 01:58 AM


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