LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-29-2013, 06:48 AM   #1
verbindingsfout
LQ Newbie
 
Registered: Sep 2013
Posts: 4

Rep: Reputation: Disabled
Folder permissions specific user


Hello guys,

I have this project in which i make a webserver, i wanted to give users access to multiple www-root folders via a single user on FTP.

The folder layout looks like this:
(penguin, sitename(1/2).tld are made up, just as example)

(Bold is what the user sees via FTP when he is in the /home/penguin/ folder)
/home/penguin/sitename1.tld/{index.html, lolwat.flv}
/home/penguin/sitename2.tld/{index.php, aybabtu.flv}

The ftp server is proftpd and the penguin user has the DefaultRoot to /home/penguin/

how would i make the the folders sitename1.tld and sitename2.tld visible but the "penguin" user should not be able to mess with these folders, so he can only acces the "sitename(1/2).tld" and put files there delete them ect. Would someone concider this a file/folder permissions problem or a groups problem? or both.

I saw something about SElinux and proftpd ftp command limmiting, i dont know where to start looking. Any advice is much appreciated

Cheers guys, Verbin

EDIT:

tl;dr, how do i lock/freeze a folder but when in it you can do everything again.

Last edited by verbindingsfout; 10-29-2013 at 08:18 AM.
 
Old 10-30-2013, 01:32 AM   #2
Ygrex
Member
 
Registered: Nov 2004
Location: Russia (St.Petersburg)
Distribution: Debian
Posts: 666

Rep: Reputation: 68
i think binding directories is what you want
 
Old 10-30-2013, 01:45 AM   #3
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 665

Rep: Reputation: Disabled
I cant say i understood it!!

Quote:
how would i make the the folders sitename1.tld and sitename2.tld visible
you want the read permission on it.

Quote:
the "penguin" user should not be able to mess with these folders, so he can only acces the "sitename(1/2).tld" and put files there delete them ect.
this contradicts each other, you want the user to write the changes and at the same time you want him not to mess with!!!! care to explain a bit more what is that ??
 
Old 10-30-2013, 04:04 AM   #4
verbindingsfout
LQ Newbie
 
Registered: Sep 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by SAbhi View Post
I cant say i understood it!!



you want the read permission on it.



this contradicts each other, you want the user to write the changes and at the same time you want him not to mess with!!!! care to explain a bit more what is that ??

Yeah i'm sorry it is as simple as you should not be able to delete or modify the folder, but inside the folder you should be able to store files and folders, also delete them inside the folder.

I got the idea to make /../pinguin/sitename.tld a mountpoint made by root so the user could not delete the mountpoint but can acces the mountpoint to work in it.

But i found a workaround, with proftpd you can set rules for folders to disable ftp commands like DELE, RMD SITE_RMDIR, which works for now. but this only works for FTP connections to which the rules are set, this project also describes the the usage of sftp but i'm not sure that i can set sftp rules.

The proftpd rules:
Code:
# here i set the sitename1.tld directory to disable DELETE commands
<Directory /home/penguin/sitename1.tld>
        <Limit DELE RMD SITE_RMDIR>
                DenyAll
        </Limit>
</Directory>
# here i enable them again inside the sitename1.tld directory
<Directory /home/penguin/sitename1.tld/*>
        <Limit DELE RMD SITE_RMDIR>
                AllowAll
        </Limit>
</Directory>
This works for now, i do have to add more other specific ftp commands to the limit section.

I looked into
Code:
chattr +i /path/to
and
Code:
chmod 1*** /path/to
which does not solve the problem

I have completely read all man pages, chattr and chmod, i have not found a solution.. yet..
 
Old 10-30-2013, 04:24 AM   #5
SAbhi
Member
 
Registered: Aug 2009
Location: Bangaluru, India
Distribution: CentOS 6.5, SuSE SLED/ SLES 10.2 SP2 /11.2, Fedora 11/16
Posts: 665

Rep: Reputation: Disabled
well chattr +i /path/to/folder will not allow even root to delete or modify the folder ! did you want that ?
 
Old 10-30-2013, 06:42 AM   #6
verbindingsfout
LQ Newbie
 
Registered: Sep 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
No
Code:
chattr +i
was not the solution, i start to get the point now, the directory is the parent of everyting in it, if you have a directory with set permissions on a basic setup the files you put in it will get the same rights(as example).

The directory has the overhand on the files and other directorys in it, so if i give write permissions on a directory you can write in it but you can also delete the directory because the directory simply is a "directing thing" pointing to a certain set of files/directorys that just point out somewhere on the disk.

The idea was to chain the directory in place like holding it tight by some root command/option as where
Code:
chattr +i
did that, the problem then was that i could not write in it. simply because
Code:
chattr +i
as i read was introduced to hold files in place when updates of root-privileged scripts occurred.

Because the /home/penguin/examplefolder is owned by pinguin itself and the /home/penguin/examplefolder should not be deleted,renamed,chmod-ded but should be written into and deleted out of by the penguin user i made this thread. guessing there is no simple root command that can do this, but in a sort of different approach would be what Ygrex said:
Quote:
i think binding directories is what you want
Could solve this since if you mount a folder to a new location as root /undeletablefolders/exmaple1.tld to /home/penguin/example1.tld you should not be able to delete the folder since it is a mount point held by root but privileged by the user
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Applying default permissions for newly created files within a specific folder mattydee Linux - Desktop 29 10-30-2016 09:55 PM
Write permissions to a specific user on a folder gsvsmanyam Linux - Newbie 3 01-25-2011 08:44 AM
Automatically set permissions of new files created within a specific folder Lorian Linux - Desktop 2 03-03-2007 03:17 PM
proftpd allow user to specific folder GUIPenguin Linux - General 4 05-18-2006 06:41 PM
Jailing a user to a specific folder ONLY GUIPenguin Linux - Security 3 09-23-2005 06:16 AM

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

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