LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-06-2024, 03:27 AM   #1
SleeperSimulant
LQ Newbie
 
Registered: May 2024
Posts: 2

Rep: Reputation: 0
Incorrect rights for certain groups


Hello everyone!

I have a Debian 12 system which uses SSH. sshd_config has been customized as follows:

Match Group sftpusers
ChrootDirectory /sftp
ForceCommand internal-sftp
AllowTcpForwarding no
X11Forwarding no
PasswordAuthentication yes

This server is to be used as an SFTP server. For this purpose, a script has been written which creates users and places them in the “sftpusers” group. Furthermore, new folders can be created, which are created in /sftp and get the permission root:sftpusers.

The following problem. When I create a session with WinSCP, I can successfully connect to it and see all subfolders of /sftp. But as soon as I want to copy, I have a permission denied.

Then I checked what the permissions look like:
drwxr-xr-x 2 root sftpusers 4096 May 6 10:21 testfolder

So the group has no write permission.

If I give /sftp this permission:
sudo chmod -R g+rw /sftp

I can log in with WinSCP but no longer with the users. I change the setting to :
sudo chmod -R g-w /sftp

I can log in again but can no longer copy.

I'm slowly running out of ideas and would be very happy to receive ideas/help.
Thank you very much!
 
Old 05-06-2024, 06:46 AM   #2
SleeperSimulant
LQ Newbie
 
Registered: May 2024
Posts: 2

Original Poster
Rep: Reputation: 0
Update: Could solve the problem in my script changing the number to 775
 
Old 05-06-2024, 07:10 AM   #3
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,333
Blog Entries: 3

Rep: Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730
Quote:
Originally Posted by SleeperSimulant View Post
I have a Debian 12 system which uses SSH. sshd_config has been customized as follows:

Match Group sftpusers
ChrootDirectory /sftp
ForceCommand internal-sftp
AllowTcpForwarding no
X11Forwarding no
PasswordAuthentication yes

This server is to be used as an SFTP server. For this purpose, a script has been written which creates users and places them in the “sftpusers” group. Furthermore, new folders can be created, which are created in /sftp and get the permission root:sftpusers.
That's the way it has to be done, because the ChrootDirectory in that case must be owned by root and not writable by any other accounts. Thus, as you've found, you can create subdictories (via root) and give write access for those other accounts to those subdirectories. The same script you have to create the accounts and add them to the group can also create the subdirectories and set their permissions since the whole script is running as root anyway.

That is one approach to setting up chrooted SFTP, and there are at least two more.
 
  


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
extended user rights in multiple groups keex Linux - Security 2 03-15-2006 08:22 PM
Incorrect Mouse, Incorrect Keymap, and Trapped in X Kenji Miyamoto Debian 8 08-24-2005 02:42 PM
Giving Kppp rights to other users n groups xxx_anuj_xxx Linux - Security 5 12-22-2004 06:12 PM
how to know a certain group has what rights in linux? funnyusa Linux - Newbie 5 06-21-2003 09:38 PM
groups and file rights tstuhr Linux - Networking 1 10-05-2001 01:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:12 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
Open Source Consulting | Domain Registration