Recommended Posts

Dauer-ASB-Surfer
mazunte schrieb vor 10 Minuten:

Danke, den Thread kenn ich schon, hilft mir aber nicht wirklich weiter.

Das Vererben der Gruppe funktioniert ja, das Problem sind die Berechtigungen.

Anscheinend muss ich da mit der umask rumspielen, da muss ich mich aber erst einlesen.

Diesen Beitrag teilen


Link zum Beitrag
Auf anderen Seiten teilen

Jesus1988 schrieb vor 7 Minuten:

Danke, den Thread kenn ich schon, hilft mir aber nicht wirklich weiter.

Das Vererben der Gruppe funktioniert ja, das Problem sind die Berechtigungen.

Anscheinend muss ich da mit der umask rumspielen, da muss ich mich aber erst einlesen.

Wie schaut denn das Netzwerk überhaupt aus?

Samba, nur Linux, eigener FTP, ssh etc.

http://serverfault.com/questions/70876/how-to-put-desired-umask-with-sftp

Ftp Server »

https://www.thomas-krenn.com/de/wiki/FTP-Server_unter_Debian_einrichten

 

bearbeitet von mazunte

Diesen Beitrag teilen


Link zum Beitrag
Auf anderen Seiten teilen

Dauer-ASB-Surfer
mazunte schrieb vor 10 Minuten:

Wie schaut denn das Netzwerk überhaupt aus?

Samba, nur Linux, eigener FTP, ssh etc.

http://serverfault.com/questions/70876/how-to-put-desired-umask-with-sftp

 

Der Link funktioniert bei mir leider nicht.

Ist ein kleiner Homeserver mit Samba, FTP (OS: Ubuntu Server)

ssh-Zugang ist aktiv.

Zugegriffen wird von Windows und Android.

 

Edit: Habs, bei deinem Link hab ich http mit s erweitert ;)

Die Lösung war "setfacl".

Danke für deine Hilfe

bearbeitet von Jesus1988

Diesen Beitrag teilen


Link zum Beitrag
Auf anderen Seiten teilen

Link als Kopie:

Does OpenSSH SFTP server use umask or preserve client side permissions after put command (chrooted environment)?


I know this question has been already discussed, but by reading the posts I could not figure the answers, 
because some said "yes umask can work", and others say "OpenSSH put command always preserve permissions"

Before all just to precise:

I use OpenSSH 5.9 on RHEL 6.2
I have configured a chrooted SFTP server, using internal-sftp subsystem, with -u 0002 for umask
I precise I don't use the -p or -P option
From what I have read on one hand: there are many ways to define umask for SFTP transfers:

option -u of internal-sftp (or sftp-server) , since OpenSSH 5.4
create a wrapper to sftp-server (in which we explicitly set the umask - this doesn't fit for chrooted environment btw)
add a specific configuration in pam.d/sshd file
On the other hand I have read:

The OpenSSH SFTP client and server do transfer the permissions (as an extension) and create the remote file with the permissions on the local side. AFAICT, there is no way to disable this behavior.
So I did the following test:

On my client I created file MYFILE and directory MYDIR with permissions 600 and 700.

Then with sftp commands:

mkdir => the new directory has permissions following the umask (OK)
put MYFILE => MYFILE has same permissions as on client (KO)
put -r MYDIR => MYDIR has same permissions as on client (KO)
If I change permissions of MYFILE and MYDIR on client side, and upload again, I get the new permissions on server side.

I tried the pam.d solution too, but it changed nothing.

So now I'm confused :

From what I tested and a part of what I read, I would say OpenSSH always preserve permissions. But as there are many posts saying that a umask could be defined, I can imagine I do a wrong thing in my test configurations.

I would appreciate some experienced feedback.

Thank you.


First, the umask is about the server not the client. 
So asking if put command of OpenSSH client uses umask is wrong. You should ask if OpenSSH server uses umask when creating a file as a result of SFTP upload.

Anyway, what OpenSSH SFTP client does:

put without -P flag, it asks the server to create a file with the same permissions as the local file has. The OpenSSH server then (implicitly by *nix rules) applies the umask.
put with the -P flag, it starts the same, but after the upload completes, the client asks the server to explicitly (re)set the permissions to the same the local file has ("chmod" request). For "chmod", the umask does not apply.
mkdir, it asks the server to create a directory with permissions 0777. The umask implicitly applies.
Anyway, I believe that umask 0002 has no effect on file with permissions 0600, as these are mutually exclusive. You should try your umask against a file with permissions like 0644.

So actually, it should work, if you have your system configured as you describe. See evidence from my box (Ubuntu with OpenSSH 6.2p2)

Match user user2
  ChrootDirectory /home/user2/chroot
  ForceCommand internal-sftp -u 0077
  AllowTcpForwarding no
  PermitTunnel no
  X11Forwarding no
See the difference in permissions after put vs. put -P:

user1:~$ touch file.txt
user1:~$ ls -l
total 0
-rw-r--r-- 1 user1 ftpuser    0 Oct 23 15:34 file.txt
user1:~$ sftp user2@localhost
user2@localhost's password: 
Connected to localhost.
sftp> cd somefolder 
sftp> put file.txt
Uploading file.txt to /somefolder/file.txt
file.txt                                         100%     0    0.0KB/s    0:00
sftp> ls -l
-rw-------    1 1003 1001    0 Oct 23 15:35 file.txt
sftp> put -P file.txt
Uploading file.txt to /somefolder/file.txt
file.txt                                         100%     0    0.0KB/s    0:00
sftp> ls -l
-rw-r--r--    1 1003 1001    0 Oct 23 15:34 file.txt
Btw, the latest SFTP specification defines behavior of the client and server regarding umask. As you can see, OpenSSH actually violates that, although the OpenSSH implements SFTP version 3 that had no mention of umask yet.

7.6. Permissions

...

The server SHOULD NOT apply a 'umask' to the mode bits; but should set the mode bits as specified by the client. The client MUST apply an appropriate 'umask' to the mode bits before sending them.
shareimprove this answer
edited Oct 24 '14 at 9:01
answered Oct 23 '14 at 9:56

Martin Prikryl
3,0351235
           
I have already tried with many different permissions, at the very start I had 755 for my directory on client side, and wanted to get 775 instead. But it didn't work. I do agree with you for the -P by reading the documentation, but even without that flag I always get on server the same permissions than client (whatever permissions are) – drkzs Oct 23 '14 at 11:17
           
thanks for the remark, i tried to improve title and correct some term – drkzs Oct 23 '14 at 11:24
           
It should works actually, see my update. – Martin Prikryl Oct 23 '14 at 13:54
           
Yes, your example does work ... but if you change umask to 0002 it doesn't anymore. Maybe this post is raising the same problem ? except the fact I am in openssh5.9 and that umask option should work. The difference between with your SSHD configuration and mine is that I don't use ForceCommand, so I specify the umask in the subsystem line. (I'll try to post config and result, but the network test is not easily reachable) – drkzs Oct 23 '14 at 15:29 
1         
Just to be clear on that point: The server SHOULD NOT apply a 'umask' only applies when the client sends permission-information. When the client does not send permission-informations it is intended behavior to apply a umask!

Diesen Beitrag teilen


Link zum Beitrag
Auf anderen Seiten teilen

Dauer-ASB-Surfer
mazunte schrieb vor 52 Minuten:

und wie geht es dem Jesus? ;)

Oh sorry, habs in meinen vorigen Post reineditiert :D

 

Jesus1988 schrieb am 4.10.2016 um 12:35 :

Der Link funktioniert bei mir leider nicht.

Ist ein kleiner Homeserver mit Samba, FTP (OS: Ubuntu Server)

ssh-Zugang ist aktiv.

Zugegriffen wird von Windows und Android.

 

Edit: Habs, bei deinem Link hab ich http mit s erweitert ;)

Die Lösung war "setfacl".

Danke für deine Hilfe

 

Diesen Beitrag teilen


Link zum Beitrag
Auf anderen Seiten teilen

  • 4 weeks later...
Dauer-ASB-Surfer

Ich mal wieder :davinci:

Habe mir ein Software-Raid1 angelegt aus zwei gleichen Festplatten mit xfs-Dateisystem. 

Ist es normal, dass der Raid-Verbund mit ext2-Dateisystem angelegt wurde?! Ist das sauber?!

Diesen Beitrag teilen


Link zum Beitrag
Auf anderen Seiten teilen

Banklwärmer

Seas Jesus,

das verwendetet FS hat nichts mit dem Raid-Verband zutun .. soll heissen, du legst die Raid-Arrays wie gewohnt mit mdadm an und danach dein gewuenschtes FS mit mkfs.XXXXX ..

Wo wird dir ext2 angezeigt?

Was ist, wenn du fdisk -l machst? Was fuer ein Type ist fuer die Partitionenen/Disk eingestellt? Ansonsten einfach FS-Type anpassen - sollte wenn ich mich nicht taeusche "fd" oder "8e" sein (eines von beiden ist LVM, eines Linux Raid - weiss ich ohne ausreichend kfe nicht ;). Das kannst du ohne Probleme im Betrieb aendern und brauchst keine Angst um deine Daten haben ;)

btw: ich denke mal du wirst es eh richtig verstanden haben, aber wenn du mit zwei vorhandenen Volumes ein Raid-Array baust, wird der Inhalt der Volumes natuerlich geloescht/ueberschrieben .. ;)

der klassiche Beisatz noch: ein Raid ersetzt _kein_ Backup. Es dient lediglich zur Ausfallssicherheit bzw. zur Erhoehung des Durchsatzes ..

bearbeitet von stockfisch

Diesen Beitrag teilen


Link zum Beitrag
Auf anderen Seiten teilen

Dauer-ASB-Surfer

Die Ausgangssituation war, dass ich zwei gleiche Festplatten (mit Daten) hatte und diese zu einem Raid1-Verbund machen wollte.

Also habe ich alle Daten auf eine Platte geschaufelt => Dann erstmal mit der leeren das Raid erstellt => Dann die Daten auf den neuen Raid-Verbund kopiert und die zweite Platte hinzugefügt.

Scheint ja auch alles zu funktionieren, nur der FS-Type macht mich ein wenig stutzig.

Hier die Ausgabe von fdisk -l:

Zitat

Medium /dev/sda: 931,5 GiB, 1000204886016 Bytes, 1953525168 Sektoren
Einheiten: sectors von 1 * 512 = 512 Bytes
Sektorengröße (logisch/physisch): 512 Bytes / 512 Bytes
I/O Größe (minimal/optimal): 512 Bytes / 512 Bytes
Typ der Medienbezeichnung: dos
Medienkennung: 0x9fc540b2

Gerät      Boot Start       Ende   Sektoren Größe Id Typ
/dev/sda1        2048 1953525167 1953523120 931,5G 83 Linux
 

Medium /dev/sdb: 931,5 GiB, 1000204886016 Bytes, 1953525168 Sektoren
Einheiten: sectors von 1 * 512 = 512 Bytes
Sektorengröße (logisch/physisch): 512 Bytes / 512 Bytes
I/O Größe (minimal/optimal): 512 Bytes / 512 Bytes
Typ der Medienbezeichnung: dos
Medienkennung: 0x38985c17

 

Medium /dev/md0: 931,4 GiB, 1000069595136 Bytes, 1953260928 Sektoren
Einheiten: sectors von 1 * 512 = 512 Bytes
Sektorengröße (logisch/physisch): 512 Bytes / 512 Bytes
I/O Größe (minimal/optimal): 512 Bytes / 512 Bytes
 

blkid sagt:

Zitat

/dev/sda1: UUID="69063c6d-8aa9-05ee-0ce5-c9440c10c498" UUID_SUB="73a0b38e-0efe-8bed-58e1-2dff48d4894a" LABEL="abcdef:0" TYPE="linux_raid_member" PARTUUID="9fc540b2-01"

/dev/sdb1: UUID="69063c6d-8aa9-05ee-0ce5-c9440c10c498" UUID_SUB="294a0176-bdb6-ee1c-f039-c0d66c768007" LABEL="abcdef:0" TYPE="linux_raid_member" PARTUUID="38985c17-01"

/dev/md0: UUID="00a316bc-350a-486b-afab-b91d263dba56" TYPE="ext2"
 

und:

Zitat

jesus@abcdef:~$ sudo file -s /dev/sda1
/dev/sda1: SGI XFS filesystem data (blksz 4096, inosz 512, v2 dirs)
jesus@abcdef:~$ sudo file -s /dev/sdb1
/dev/sdb1: SGI XFS filesystem data (blksz 4096, inosz 512, v2 dirs)
jesus@abcdef:~$ sudo file -s /dev/md0
/dev/md0: Linux rev 1.0 ext2 filesystem data (mounted or unclean), UUID=00a316bc-350a-486b-afab-b91d263dba56 (large files)

 

Diesen Beitrag teilen


Link zum Beitrag
Auf anderen Seiten teilen

Banklwärmer

Seas,

ad fdisk: da wuerde ich den Type anpassen ...

aus man blkid:

     -c cachefile
              Read from cachefile instead of reading from  the  default  cache
              file  (see the CONFIGURATION FILE section for more details).  If
              you want to start with a clean cache (i.e. don't report  devices
              previously  scanned but not necessarily available at this time),
              specify /dev/null.

-> ich wuerde also vorschlagen, einmal ein  blkid -c /dev/null abzusetzen .. da sollte dann hoffentlich das erwartete Ergebnis rauskommen ..

Diesen Beitrag teilen


Link zum Beitrag
Auf anderen Seiten teilen

Dauer-ASB-Surfer
stockfisch schrieb vor 2 Stunden:

Seas,

ad fdisk: da wuerde ich den Type anpassen ...

aus man blkid:

     -c cachefile
              Read from cachefile instead of reading from  the  default  cache
              file  (see the CONFIGURATION FILE section for more details).  If
              you want to start with a clean cache (i.e. don't report  devices
              previously  scanned but not necessarily available at this time),
              specify /dev/null.

-> ich wuerde also vorschlagen, einmal ein  blkid -c /dev/null abzusetzen .. da sollte dann hoffentlich das erwartete Ergebnis rauskommen ..

Was meinst du mit Type anpassen, welchen Type und von was auf was ?! :ratlos:

blkid -c bringt auch kein anderes Ergebnis als ohne -c...

Diesen Beitrag teilen


Link zum Beitrag
Auf anderen Seiten teilen

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Auf dieses Thema antworten...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Folge uns auf Facebook

  • Partnerlinks

  • Unsere Sponsoren und Partnerseiten

  • Wer ist Online

    • Keine registrierten Benutzer online.