Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Linux
  3. Trouble Fixing permissions for SFTP

Trouble Fixing permissions for SFTP

Scheduled Pinned Locked Moved Linux
linux
6 Posts 5 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jackattack@lemmy.dbzer0.comJ This user is from outside of this forum
    jackattack@lemmy.dbzer0.comJ This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #1

    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!

    J F X B 4 Replies Last reply
    1
    0
    • System shared this topic on
    • jackattack@lemmy.dbzer0.comJ [email protected]

      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!

      J This user is from outside of this forum
      J This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #2

      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

      jackattack@lemmy.dbzer0.comJ 1 Reply Last reply
      0
      • J [email protected]

        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

        jackattack@lemmy.dbzer0.comJ This user is from outside of this forum
        jackattack@lemmy.dbzer0.comJ This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #3

        Awesome. I'll give this a try later and get back to you. Thanks!

        1 Reply Last reply
        0
        • jackattack@lemmy.dbzer0.comJ [email protected]

          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!

          F This user is from outside of this forum
          F This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          • jackattack@lemmy.dbzer0.comJ [email protected]

            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!

            X This user is from outside of this forum
            X This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #5

            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/./.
            
            1 Reply Last reply
            0
            • jackattack@lemmy.dbzer0.comJ [email protected]

              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!

              B This user is from outside of this forum
              B This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #6

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

              1 Reply Last reply
              0
              • System shared this topic on
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups