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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
05-19-2003, 12:14 PM
|
#1
|
|
LQ Newbie
Registered: May 2003
Location: NYC
Distribution: RH linux 8.0
Posts: 19
Rep:
|
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.)
|
|
|
|
05-19-2003, 01:19 PM
|
#2
|
|
Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,611
Rep:
|
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
|
|
|
|
05-19-2003, 03:49 PM
|
#3
|
|
LQ Newbie
Registered: May 2003
Location: NYC
Distribution: RH linux 8.0
Posts: 19
Original Poster
Rep:
|
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.)
|
|
|
|
05-19-2003, 11:17 PM
|
#4
|
|
Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,611
Rep:
|
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
|
|
|
|
05-20-2003, 10:03 AM
|
#5
|
|
LQ Newbie
Registered: May 2003
Location: NYC
Distribution: RH linux 8.0
Posts: 19
Original Poster
Rep:
|
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.
|
|
|
|
05-20-2003, 11:03 AM
|
#6
|
|
Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu
Posts: 12,611
Rep:
|
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
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 10:55 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|