Jump to content

How to enable write/delete permissions via SSH/WinSCP


FrostByte

Recommended Posts

FrostByte

Posting this for people who like myself are new to Unix/Synology and want to use WinSCP with write/delete capabilities to have more control when managing their Emby server from a Windows machine.   

 

Warning!!  Once you've done this you will have administrator access using WinSCP all the way to the root folder of your NAS and you can really mess things up if you're not sure what your're doing.

 

1. Reset superuser privileges on NAS.  This will also stop the sudo command from prompting administrators for a password in order to work with WinSCP.

 

Open DSM Control Panel

 

Click Task Scheduler

 

Create a task

 

5d8299be33a27_1.png

 

General tab:

 

5d8299dde115b_2.png

 

(Uncheck "Enabled")

 

Task Settings tab:

 

5d829a1c93f8b_3.png

 

text version of "Run command" field (copy/paste the information below to be safe):

cat <<EOF > /etc/sudoers
Defaults syslog=authpriv
root ALL=(ALL) ALL
%administrators ALL=NOPASSWD: ALL
EOF
chmod ug=r,o= /etc/sudoers

(Click "OK")

 

Then run the new task you just created*:

 

5d829a6eb8ab4_5.png

 

(Click "Yes")

 

* You may need to run the task again after every DSM update as Synology tends to reset these privileges themselves

 

---

 

2. Enable SSH on NAS

 

Open DSM Control Panel

 

Click Terminal & SNMP

 

Terminal tab:

 

5d82f308259a2_6.png

 

(Check "Enable SSH service" and then click "Apply")

 

---

 

3. Setup WinSCP

 

Download and install WinSCP on Windows machine

 

https://winscp.net/eng/download.php

 

Allow WinSCP to start

 

Login box:

 

5d82f729cfbc4_7.png

 

File protocol: SCP

Host name: enter the NAS host name or IP address

Port number: enter the port number from step 2

User name: "admin"

Click "Login"

 

 

Password:  use your admin password

 

winscp.jpg.6d91c0479b8860db2ffa1e09f790a4aa.jpg

Edited by FrostByte
Added WinSCP advanced settings
  • Like 3
Link to comment
Share on other sites

  • 7 months later...
FrostByte

Basically, it's what is going to allow your admin account to log into the NAS as root which was locked down in DSM6.  DSM updates tend to reset this back thus the script is there so you can rerun it after an update. 

 

You can use WinSCP without it though

Link to comment
Share on other sites

crusher11

I'm trying to copy my old collections across and I'm getting an "access denied" error which I assume is related though?

 

That step just seems to remove all passwords or something which doesn't seem super secure or anything.

Link to comment
Share on other sites

FrostByte

That just prevents sudo from prompting WinSCP for the password.  You enter your admin password in the box provided by WinSCP.  It doesn't eliminate the need for a password though

 

 

I would just skip step 1 for now and see what you can/can't do using WinSCP and your admin account without that step. 

Link to comment
Share on other sites

crusher11

Like I said I'm getting an "access denied" error trying to copy my collections across.

Link to comment
Share on other sites

crusher11

I tried that, it's still saying "Permission denied" when I try to copy across. I closed WinSCP and reopened it and logged back in after running the script.

 

However, I'm logged in with my username not as "admin", because it denies access when I try to log in as "admin".

Link to comment
Share on other sites

  • 7 months later...
Aussiedroid

Thanks a lot for posting this information @FrostByte

I can access the Emby folders again! .. but I am hitting the same issue as @crusher11, even after performing step 1.

 

I can copy files/folders from the /Emby/data/collections directory, but if I try to copy something back it does not allow it (Access Denied). I have tried to edit directly from the NAS too (rather than via Windows PC), but same issue when I try to save. I can copy files to the /Emby master folder but not the sub folders it seems.

 

I am logged in with Admin user, but the owner of the files/folders is the Emby user. I assume this may be why it is preventing me from updating the file?

Have tried to log in with the Emby user instead but I am not sure what the password would be as I don't recall ever setting this user up.

 

Would you know of a way to get around this issue?

 

Can I simply perform a password update/reset in DSM for Emby user and then log in via WinSCP with the new password (or could this break the Emby Server)? or Can I grant write access to the Admin user somehow while retaining Emby user as the owner? Do I need to set R/W permissions somewhere else perhaps?

As a bit of a novice with this stuff, I am not sure how best to proceed. Appreciate any advice before I inadvertently break something ;)

 

Thank you,

AD

 

Edited by Aussiedroid
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...