Synology DSM6.2 change eMule client username

1- Stop DownloadStation

Once logged into the shell get the service name

synoservicecfg --list | grep station

service name is pkgctl-DownloadStation

synoservicectl --stop pkgctl-DownloadStation
2- Edit the configuration file

Edit as root /usr/syno/etc/packages/DownloadStation/amule.conf

change line Nick=http://emule-project.net

Save and exit.

3- Start DownloadStation again
synoservicectl --start pkgctl-DownloadStation

 

Synology DSM6.x poweroff command as root user

1- We want to be able to poweroff or reboot our Synology using SSH.

remote user name: admin

remote machine name (Synology NAS): syno.lan

Prerequisite: SSH login should be password-less.

2- login to admin@syno.lan
ssh -i .ssh/id_syno admin@syno.lan
3- New sudoers entry

In order to allow ‘admin’ to execute specific commands as ‘root’, we should edit the sudoers file.

But instead of editing /etc/sudoers, which might be later edited during a system upgrade, we simply add our file into /etc/sudoers.d/

In addition on DSM6.x the sudoers file has not writable permission.

sudo vi /etc/sudoers.d/powercmds

edit as follow:

# allow user 'admin' to poweroff/reboot
Cmnd_Alias POWERCMDS = /sbin/poweroff, /sbin/reboot
admin ALL=(root) NOPASSWD: POWERCMDS

User ‘admin’ can now execute POWERCMDS as ‘root’ user.

Then save and logout.

4- Test from client

To verify, without rebooting, we can just print the version:

ssh -t -i .ssh/id_syno admin@syno.lan "sudo reboot --version"

Note: switch ‘-t’ has been added. From SSH manual:

-t Force pseudo-terminal allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.

5- Poweroff from client
ssh -t -i .ssh/id_syno admin@syno.lan "sudo poweroff"

 

 

 

 

 

 

SSH without password on Synology DSM6.x

1 – Introduction

local user name: cesare

local machine name: desktop.lan

remote user name: admin

remote machine name (Synology NAS): syno.lan

We want cesare@desktop.lan able to connect to admin@syno.lan through SSH without password.

2 – Enable Home service on Synology

Connect to http://syno.lan and check on webUI:

Control Panel => User => Advanced => User Home

“Enable user home service” must be enabled

3- Enable SSH service on Synology NAS

Control Panel => Advanced Mode => Terminal & SNMP

“Enable SSH service” must be enabled

4- Generate ssh key

On our local machine cesare@desktop.lan (the client) we generate the SSH key:

syntax: ssh-keygen -t <key-type> -f <path-to-file> -C “<login>@<host-ip>”

desktop.lan$ cd

if directory .ssh doesn’t exist create it:

desktop.lan$ mkdir .ssh
desktop.lan$ ssh-keygen -t ed25519 -f .ssh/id_syno -C “cesare@desktop.lan”

The switch -C add the “localusername@localaddress” comment in the key content. This can be useful later because we can easily recognize to whom the key belongs to when viewing the file authorized_keys.
This command will ask for a passphrase, for simplicity leave it blank (press enter).

5- Move the public key to the Synology server

Transfer .ssh/id_syno.pub into the ssh folder on admin@syno.lan

syntax: ssh-copy-id -i <public-sshkey> <login>@<host-ip>

ssh-copy-id -i .ssh/id_syno.pub admin@syno.lan
6- Change the permissions on the remote shell
desktop.lan$ ssh admin@syno.lan

The password this time will be asked.

admin@syno.lan$ chmod 644 .ssh/authorized_keys
admin@syno.lan$ chmod700 .ssh
admin@syno.lan$ chmod 755 /var/services/homes/admin
admin@syno.lan$ exit
7- It’s time to reconnect without password
desktop.lan$ ssh -i .ssh/syno_id admin@syno.lan
8- If any problem

If any issues with ssh command just add the -v option. From ssh manual:

-v Verbose mode. Causes ssh to print debugging messages about its progress. This is helpful in debugging connection, authentication, and configuration problems. Multiple -v options increase the verbosity. The maximum is 3.

Nextcloud: move/import Notes

How to move all Notes from an instance or backup to a new Nextcloud instance:

Move/copy the Notes folder, typically /www/var/nextcloud/<user>/files/Notes to the new instance, Notes app must be already installed.

Then, on the destination instance, trigger the file scan to rebuild the file cache:

cd /var/www/nextcloud
sudo -u www-data php occ files:scan -p <user>/Notes --all -v

 

WordPress Themes