LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-19-2003, 12:14 PM   #1
Rgamboa
LQ Newbie
 
Registered: May 2003
Location: NYC
Distribution: RH linux 8.0
Posts: 19

Rep: Reputation: 0
umask and default file create permissions


I understand how to use umask in my .profile. It turns off default permissions. But how do I turn ON default permissions? If the default file create permissions are 0666 and I want them to be 0777, what do I have to do in my .profile? (Sorry if this is a dumb question.)
 
Old 05-19-2003, 01:19 PM   #2
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
set a umask of 7000:
umask=7000

However, that's just plain a bad idea. Default permissions (and permissions in general) are there for system safety, system integrity and for personal privacy. If you set a umask of 000 (or chmod 777) on all your files then everyone can see them, alter them, delete them, write over them... Bad idea.

Cool
 
Old 05-19-2003, 03:49 PM   #3
Rgamboa
LQ Newbie
 
Registered: May 2003
Location: NYC
Distribution: RH linux 8.0
Posts: 19

Original Poster
Rep: Reputation: 0
Clarification

I'm sorry if I misled you. I only want to add permissions when FTP'ing in from the outside using one special userid. Also, I don't think that umask can turn on additional permissions; it can only specify read-write-execute permissions to be turned off. So the real question is either 1) how can I change the default file creation permissions, or 2) how can I issue a 'chmod' from another server? (Perl's FTP modules doesn't seem to have a chmod() function.)
 
Old 05-19-2003, 11:17 PM   #4
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
Do you have access to the server you are ftp-ing into? Which ftp server are they using? In proftpd you can specify your umask desires, but you can also set specific directory calls:
Code:
<Directory /*>
  <Limit READ>
   AllowAll
  </Limit
</Directory>
Other options are the global umasks, but that would set it for everyone ftp'ing in. As for umask turning on/off permissions I don't think it's quite like that. It's not on or off, it's setting the permissions:
000 = 777
111 = 666
And so on. So a umask of 000 gives full permissions, it doesn't turn something on or off AFAIK.

So... what kind of options do you have? Well, what server is the FTP server? Do you have admin control over it? Are you ftp'ing in when you might wanna consider ssh'ing?



Please, just try to tell us a bit more about your setup, it'll help to get a bit more of a response

Cool
 
Old 05-20-2003, 10:03 AM   #5
Rgamboa
LQ Newbie
 
Registered: May 2003
Location: NYC
Distribution: RH linux 8.0
Posts: 19

Original Poster
Rep: Reputation: 0
Thanks!

Thanks for not giving up on me. We own both servers and, yes, I have superuser access to each. (WHEE!) We use ssh to login and sftp for file transfer. We want server1 to ftp to server2 using username 'cronman'. We want files created to have more liberal permissions than we're getting. We tried setting umask in cronman's .profile but it can only turn permissions off, not on. I just ran a test with umask to prove this:

% echo >temp.fil
% ls -adl temp*
-rw-rw-rw- 1 dhannott staff 0 May 20 10:55 temp.fil
% umask
0
% umask 0007
% echo >temp2.fil
% ls -adl temp*
-rw-rw-rw- 1 dhannott staff 0 May 20 10:55 temp.fil
-rw-rw---- 1 dhannott staff 0 May 20 10:55 temp2.fil

As you can see, umask turned off global permissions, but failed to turn on any owner or group permissions.
 
Old 05-20-2003, 11:03 AM   #6
MasterC
Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,612

Rep: Reputation: 64
Ok, so looking over the docs at proftpd (I'm still assuming that's the FTP server you are using ) it looks like you could set it up on a per directory basis on the server side. If this is a public folder you probably don't want to do this. If this is public, you could setup a private directory where your user ftp's into, make it have the chmod 777/umask 000 and then have a cron setup to move the files (every 5 minutes or so) in /path/to/private to /path/to/public after chmodding them 555 or something more restrictive. Here's the directory syntax I'd try in the proftpd.conf file (make sure you are doing this outside of your <Anonymous> block):
<Directory /home/testuser/testdirectory/*>
umask 0007
<Limit READ>
AllowAll
</Limit>
<Limit WRITE>
AllowAll>
</Limit>
<Limit EXEC>
AllowAll
</Limit>
</Directory>
Then restart proftpd either by sending the HUP to your inetd pid or for standalone just restarting proftpd:
proftpd restart

Short of that working, you could setup a cron to chmod your files, but that would be taxing your system if you had it running every minute. Another option is to setup a global umask 000 and then set limits in every users profile (if that's even feasible) to restrict that.

If none of that works, post back and I'll do some more looking

Cool
 
  


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
Restore all default file permissions pauliehaha Linux - General 4 05-25-2011 11:56 PM
Umask and Linux Default Permissions Sandoomaphone Linux - Security 9 08-23-2004 04:48 PM
Is it possible to create default file permissions? Thermodynamic Linux - Software 3 04-09-2004 05:28 PM
Where to set default file permissions (umask)? tredegar Linux - Newbie 14 01-27-2004 05:10 PM
default file rights with umask MartinMiller Linux - General 6 10-22-2003 10:04 AM


All times are GMT -5. The time now is 11:27 AM.

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