A question about default groups & permissions for uploaded files
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.
A question about default groups & permissions for uploaded files
I've never quite got this, so maybe someone can help out.
I installed a new drive for storing ISOs & VMs. Got it mounted at /kvm and created the directories /kvm/iso & /kvm/vm. This is as root, so the directory looks something like this:
drwxr-xr-x 5 root root 4096 Oct 2 23:21 ./
drwxr-xr-x 24 root root 4096 Oct 2 22:48 ../
drwxr-xr-x 2 root root 4096 Oct 2 23:21 iso/
drwxr-xr-x 2 root root 4096 Oct 2 23:21 vm/
I want to copy files using scp, and authenticating as a non-root account (drunk) that's in the libvirtd group. Because I'm lazy, I want that copied file to automatically have its group and permissions set for libvirtd so KVM can use it without having to run a chgrp/chmod on the file directly.
So I change the group of iso: sudo chgrp libvirtd iso
And change the permissions on the directory: sudo chmod 770 iso
And I can copy up a file: scp ubuntu-12.04.3-server-amd64.iso drunk@remote:/kvm/iso
I can see the file up at its destination
drwxrwx--- 2 root libvirtd 4.0K Oct 2 23:29 ./
drwxr-xr-x 5 root root 4.0K Oct 2 23:21 ../
-rwx------ 1 drunk drunk 665M Oct 2 23:31 ubuntu-12.04.3-server-amd64.iso*
So, my question is
1) How can I get that directory configured so new files automatically belong to the libvirtd group?
2) And that the group permissions are set to rwx?
Is this possible?
Thanks!
Last edited by DrinkinHomeBrew; 10-03-2013 at 12:25 AM.
if you log into the system as user "drunk" via scp than anything uploaded will automatically belong to user "drunk"
Right, and I would understand and expect that the owner will always be the user who uploaded it. I was hoping I could set it so that the group defaults to a specified group (e.g. libvirtd or web-data).
If I'm forced to make the extra step of changing the group & permissions, that's fine. I was just hoping there was a way around having to do that all the time.
Last edited by DrinkinHomeBrew; 10-03-2013 at 12:28 AM.
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
Quote:
Originally Posted by DrinkinHomeBrew
Right, and I would understand and expect that the owner will always be the user who uploaded it. I was hoping I could set it so that the group defaults to a specified group (e.g. libvirtd or web-data).
If I'm forced to make the extra step of changing the group & permissions, that's fine. I was just hoping there was a way around having to do that all the time.
the one way i can think of is have a cron job do it hourly, not sure if that's quick enough for you though.
Yup. That's what I was looking for. That solved the first item.
After about 3-4 hours of playing around with umask and acls, I think I finally got default permissions to work as I wanted. It probably took 2 hours longer than it should have because I was copying files from cygwin, and that seemed to be the root cause of why it wasn't setting any of the group/other permissions. On a lark, I tried using scp from linux to copy a file over, and I got the permissions I wanted.
Thought that would be it
I'd stick to using scp or pscp from putty toolset if you've got a win client or even Filezilla; a nice gui using sftp
If you use Filezilla, do tell it port 22 or it'll use ftp instead
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.