Context

I’m not very used to permissions based access so please forgive some of the ignorant attempts. For context, i have a jellyfin media server running on a mini PC. My previous way of transfering media to the server was using a secondary portable SSD and just plugging it in directly and moving the files to the main SSD. Originally the SSD was formatted to VFAT.

Issue

I had the idea that maybe using SFTP would allow me to just be able to drop in the files id like to host and simplify this process. With the original context above, I set up SSH and copied the id_rsa key over to the headless machine and launched sftp. This worked great but i was unable to add more files to the directory via SFTP, only read them.

Attempted

Skipping over discovering that VFAT is not linux permission friendly except on mounting options, I reformatted the drive to Ext4. This is where i began running into issues.

I relized the drive had permissions to root:root so i started trying to change them. First i made a group called jellyfin, and tried to run the following:

sudo chown mainuser:jellyfin /media/jellyfin

to try to set ownership to the mainuser while adding the jellyfin group to it. I then edited the same sftpuser to the jellyfin group. For the final file editing, i ran the following (initially tried 765 in hopes of 7 for owner, 6 for group, and 5 for everyone else):

sudo chmod 777 /media/jellyfin

I also set the starting sftp area for sftp user to that directory as well.

Current problem

Neither SFTP or Jellyfin is now able to see that directory path. On SFTP I’m getting “FATAL: Connection reset by peer” while on jellyfin im getting playback errors for all media as well as not able to discover new media i manually added to the drive.

On the actual vm console, im able to cd and view all files under sftpuser and verified I was able to add that user to the jellyfin group. Any advise here would be great. I’m also happy to provide more context as well.Thanks!

  • just_another_person@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    1 day ago

    Connection reset by peer could mean the ssh service is down, so check there.

    As far as permissions, you need to set them on an entire directory with chown -R /some/directory

  • Xanza@lemm.ee
    link
    fedilink
    English
    arrow-up
    3
    ·
    23 hours ago

    Make sure when you change permissions, they’re recursive. The way you’ve been doing it has only been on /media/jellyfin folder and nothing within that directory.

    sudo chown -R mainuser:jellyfin /media/jellyfin; sudo chmod -R 764 /media/jellyfin
    

    764 permissions are rwxrw-r--, which is most likely what you want;

    Owner: r/w/e
    Group: r/w/.
    Public: r/./.
    
  • BCsven@lemmy.ca
    link
    fedilink
    arrow-up
    1
    ·
    23 hours ago

    You may be able too ssh in as the media user and not root, so that permission is set properly for that user/group

  • flatbield@beehaw.org
    link
    fedilink
    English
    arrow-up
    1
    ·
    24 hours ago

    A few hints. For the user your using to log into SFTP the .ssh director must be somthing like 700. The directories above it must be somethin like 750 or 755. This is so you ssh keys are secure.

    A far as any data directories you want to access, like 755, 775, or 777, depending on what you want. Also umask setting may matter for new files.

    This is not Jellyfin specific just generally how this worka.