Re: Security question regarding directory and file permissions

From: Vilmos Soti (vilmos_at_vilmos.org)
Date: 06/06/03


Date: 05 Jun 2003 22:48:12 -0700

mwathke@netscape.net (Mhoram) writes:

> I create a directory called /test with permissions of 777. Then, as
> user1, I create a file called testfile in that directory. The file
> has permissions of 664, owner is user1, and group is user1. I then
> log in as user2, change to the test directory, and edit the file using
> vi. Vi correctly states that the file is being opened read-only.
> While still in vi, I add a line to the file and try to save it using
> :w to which vi again states that the file is read-only. So far so
> good. But if I save my changes using :w! - vi allows the change.
> When I exit vi and do an ls, the file still has permissions of 664,
> but is now owned by user2 with a group of user2.

The thing is that the directory is 777 w/o the sticky bit set.
Check the chmod manpage (not too long), and look for the section
when it explains the STICKY DIRECTORIES.

I, as a regular user, can easily erase files owned by root
provided they are in a directory which is write-enable for me.

Go ahead, create a file in your home directory as root, then
erase it as the non-root user. You will succedd.

Vilmos



Relevant Pages

  • Re: Root Access
    ... Doing so as root will be a disaster. ... Many X programs are not designed to run with root privileges ... in as a regular user, run your app and if it needs root privileges ... Administrator account) with disasterous results. ...
    (Fedora)
  • Re: Internet only as root
    ... >True if I log on as root and start a internet connection,then log on as ... So everything works for the regular user after starting the connection ... A script to start it with root privledges comes to mind quickly. ...
    (Fedora)
  • Re: 2.6.0-test6 crash while reading files in /proc/fs/reiserfs/sda1
    ... >>I did this as a regular user and also as root. ... The kernel was compiled with GCC ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: problem logging in.
    ... I logged in as root and deleted the user that was giving me the ... after logging in as a regular user though. ... > stuff I needed to install. ... > my regular user and bypass the login screen. ...
    (alt.os.linux.suse)
  • Re: [SLE] Re: NEW! "CD Burner HELL"! fixed?
    ... > You don't suppose that he means it burns cd's as root, ... > regular user do you? ... root but not as reg. ... What fails, CD or DVD burning? ...
    (SuSE)

Quantcast