LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 10-03-2013, 01:22 AM   #1
DrinkinHomeBrew
LQ Newbie
 
Registered: Oct 2011
Posts: 26

Rep: Reputation: Disabled
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 01:25 AM.
 
Old 10-03-2013, 01:24 AM   #2
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,202

Rep: Reputation: 397Reputation: 397Reputation: 397Reputation: 397
if you log into the system as user "drunk" via scp than anything uploaded will automatically belong to user "drunk"
 
Old 10-03-2013, 01:27 AM   #3
DrinkinHomeBrew
LQ Newbie
 
Registered: Oct 2011
Posts: 26

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by frieza View Post
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 01:28 AM.
 
Old 10-03-2013, 01:31 AM   #4
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,202

Rep: Reputation: 397Reputation: 397Reputation: 397Reputation: 397
Quote:
Originally Posted by DrinkinHomeBrew View Post
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.
 
Old 10-03-2013, 03:18 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Code:
chmod g+s dirname
??
 
Old 10-03-2013, 05:15 AM   #6
DrinkinHomeBrew
LQ Newbie
 
Registered: Oct 2011
Posts: 26

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by chrism01 View Post
Code:
chmod g+s dirname
??
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.
 
Old 10-03-2013, 07:19 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
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
 
  


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
Question about File Permissions / Default groups mortonmorton Linux - Newbie 5 11-07-2009 06:29 PM
How do I set default permission for files uploaded? neocontrol Linux - Security 1 01-25-2008 04:04 PM
Re: Vsftpd uploaded files Permissions silver05 Linux - Software 2 09-30-2005 09:22 AM
Uploaded Files permissions (proftpd) Wynand1 Linux - Security 1 01-28-2005 04:32 AM


All times are GMT -5. The time now is 09:33 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration