LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 09-11-2016, 07:27 PM   #1
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Rep: Reputation: 54
Is there a way to get read/write access to folder as another user without having to chmod 777?


I HATE HATE HATE the linux permission system, it's garbage. But that said..

Is there a way I can gain access to a folder, without having to make it owned as my user or having to chmod it 777?

I have lot of different file shares throughout my servers, I'm ditching NFS for SMB hoping to gain a bit of security, problem is it's giving me tons of issues with permissions. As an example I have a folder where it's owned by

user1:user1

My actual account is user2. I'm part of the user1 group, but that does not seem to be enough. Everything is chmodded 775. Yet I still can't create folders or do much. If I chmod everything 777 it works, but that's super dirty.

Is there a way to just make this work properly without everything having to be owned by my user?
 
Old 09-11-2016, 07:33 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,627

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
Quote:
I HATE HATE HATE the linux permission system, it's garbage. But that said..
i like it better than the garbage in windows

set the user and group policies

if for example you have 3 people that need read/write to a folder
make a new "group" and the users to it and give the group the R/W permission

normally the " user : group " would be "tom:users" , "dick:users" , "harry:users"

add the persons user name to the "users" group

Last edited by John VV; 09-11-2016 at 07:35 PM.
 
Old 09-11-2016, 07:42 PM   #3
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
SMB is more secure than NFS? NFSv4 is secure enough to be accessed over internet, how about Samba?
 
Old 09-11-2016, 07:44 PM   #4
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Windows' system is way more flexible.

The group thing has never worked properly for me in Linux, as is the example here. Despite being in the same group as the folder I still can't write to it. Here's what the samba share looks like:

Code:
[share]
        comment = desc
        path = /volumes/raid1/share
        writable = yes
        broweseable = yes
        guest ok = no
        valid users = user2, user3
        force user = user1
        force group = user1
Everything in that folder is to be owned by user1. I'm user2. Everything chmodded 775.
 
Old 09-11-2016, 07:46 PM   #5
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
SMB was never designed to be exposed to external networks, but NTFS/SMB is quite secure on local networks, and ACL's provide much more permissions granularity than standard linux owg permissions.

For SMB access permissions, keep in mind it's the windows user that controls permissions, not the linux user account.
 
Old 09-11-2016, 07:46 PM   #6
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Quote:
Originally Posted by Emerson View Post
SMB is more secure than NFS? NFSv4 is secure enough to be accessed over internet, how about Samba?
NFS relies on user/group IDs and not passwords, which has laughable security. NFSv4 can be setup with kerberos and all that, but that's a huge pain in the ass to setup and it has to be setup on a per machine basis. I should not need to have a PHD just to share files. And I think it STILL wants the user/group IDs to match on each system. It's ridiculous really.
 
Old 09-11-2016, 07:48 PM   #7
Doug G
Member
 
Registered: Jul 2013
Posts: 749

Rep: Reputation: Disabled
SMB was never designed to be exposed to external networks, but NTFS/SMB is quite secure on local networks, and ACL's provide much more permissions granularity than standard linux ugw permissions.

For SMB access permissions, keep in mind it's the windows user that controls permissions, not the linux user account.
 
Old 09-11-2016, 07:55 PM   #8
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Wait, I know there are separate SMB users that map to the Unix ones and got that setup, but is there the same for groups? I wonder if I have to create special groups?
 
Old 09-11-2016, 09:23 PM   #9
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Decided to take the F it approach. As dirty as it is, I'm just going to make every single one of my share folders owned by myself. My philosophy was that if this was a network with multiple users some of those folders I may want to give more than one user access, but given Linux's archaic file permission system that does not seem to be very easy to do and I'm in reality the only person that needs access so... screw it.

I hear there's an ACL system in Linux, I just wish it was native. Any time I've tried to use it I just get "not supported". Guessing you need to do/install something special for it to work.
 
Old 09-11-2016, 09:52 PM   #10
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Bah ended up just going back NFS. Realized my whole idea of using Samba was kinda lost if I was forced to make so many changes at the server level permissions. Just going to deal with the stupidity of having to create all users/groups on each machine and having to match the IDs. So basically decided to go back to my old setup.
 
Old 09-11-2016, 09:55 PM   #11
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Set up NIS if you do not like matching UID:GID.
 
Old 09-12-2016, 12:48 AM   #12
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,806

Rep: Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207Reputation: 1207
The Unix way:
own the shared directory by a common Unix group. And have 2775 permissions on directories.
To create group-writable files and directories, each user sets umask 002 (during login e.g. .profile)
The g+s bit is inherited when a subdirectory is created. Its purpose is to force the common group, even if the user's primary group is different.

Last edited by MadeInGermany; 09-12-2016 at 09:13 PM. Reason: typo
 
2 members found this post helpful.
  


Reply



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
[SOLVED] Give User Read/Write Access to HTML Folder ep7network0819 Linux - Server 2 05-09-2016 11:16 AM
FTP server with Users read only access in 777 folder Almaz Linux - Server 1 01-29-2014 03:20 PM
[SOLVED] chmod 777 a directory only for a user not for all ytd Linux - General 16 05-14-2010 12:15 AM
Folder/File sharing and read/write access? JET-33 Linux - Server 2 04-04-2007 11:13 PM
where a service should place a folder so every user can have read/write access. shahidawan Linux - Security 3 05-07-2005 01:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 02:54 AM.

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
Open Source Consulting | Domain Registration