Linux - NewbieThis 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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.)
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.
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.)
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:
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
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.
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.