- WD Community
- :
- Network Devices
- :
- Live Duo
- :
- attaching accounts to sftp
- WD Community
- News & Assistance
- Announcements
- New to Community
- Forum Feedback
- Off-Topic
- Software & Apps
- WD Software
- WD Mobile Apps
- Software & Accessory Ideas
- WD TV Live Streaming
- Live Streaming Discussions
- Live Streaming Firmware
- Live Streaming Ideas
- Live Streaming Issues
- WD TV Live Hub
- Hub Discussions
- Hub Firmware
- Hub Themes
- WD TV Live Hub Ideas
- WD TV Live Hub Issue Reporting
- WD TV Play
- WD TV Play
- Live & Live Plus
- Live Discussions
- Live Firmware
- Elements Play
- Elements Play
- External Drives
- Mac Externals
- PC Externals
- Portable Drives
- External Drive Ideas
- Network Devices
- Networking Devices
- Live Duo
- Sentinel
- My Book Live
- Other Network Drives
- Network Product Ideas
- Internal Drives
- Desktop & Portable
- Internal Drive Ideas
- Anuncios
- Noticias
- Nuevo a La Comunidad
- Los Productos de WD
- Software y Accesorios
- Reproductores Multimedia
- Unidades de Red
- Unidades Externas
- Unidades Internas
- Ankuendigungen
- Neuigkeiten
- Neu in der Community
- WD Produkte
- WD Programme
- WD TV Media Player
- Netzwerk Laufwerke
- Externe Laufwerke
- Interne Laufwerke
- Annunci
- Annunci e Novita'
- Nuovo per La Comunita'
- Prodotti WD
- Programmi & Accessori
- Riproduttori Multimediali
- Dischi di Rete
- Dischi Esterni
- Dischi Interni
- WD TV Legacy
- Hub Network
- Live Networking
- WD TV HD
- WD TV Mini
- Software
- WD Photos
- Other Software & Accessories
- Hard Drives
- WD ShareSpace
- Other Externals
- Other Internal Drives
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
attaching accounts to sftp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-10-2012 09:20 AM
In short: How do I set up sftp access to the NAS shares?
So I can ftp into my MBLD with no problems using a created (non-admin) account, and I can ssh in as 'root', and I can sftp in as 'root'.
What I'd like to be able to do is sftp in with the created account ID, ideally restricted to the shares configured through the web interface - so the same as the FTP access, but with the added security of SFTP rather than FTP.
Anybody tried setting this up yet and able to offer some hints? A quick Google suggests creating a separate folder structure for those users and modifying the SSH config, but I'm not sure how to do that without breaking the existing setup with users matched to shares.
I could have a play, but as this is my only NAS I'm keen not to need to reflash it ![]()
Solved! Go to Solution.
Re: attaching accounts to sftp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-11-2012 08:28 AM
bumping on this one dude
try talking to Myron since he's more acquainted with SSH
Re: attaching accounts to sftp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-11-2012 04:54 PM
I've sort of looked at this one too but am too scared of changing the SSH configuration in case I do something wrong what kills the SSH daemon or messes up the configuration that SSH access is no longer possible.
My guess is that you will need to add users to the line that starts with AllowUsers within the file /etc/ssh/sshd_config.
WD has configured it so the only allowed user is root. I guess you can add additional users to this line, restart the SSHD and aditional users will be allowed to connect via Telnet and SFTP.
Re: attaching accounts to sftp
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-14-2012 10:18 AM - edited 06-14-2012 10:19 AM
DISCLAIMER : Messing up the stuff below can and will prevent you using SSH to access your My Book Live Duo. It's your own fault, go buy a new one.
Ok, I've had a play. First up, cheat like **bleep** in case I break it:
ssh root@<MBLD-IP-address> cd /shares/tmp cp /etc/ssh/sshd_config ./sshd_config_bak ln -s /etc/ssh/sshd_config
I can now use the shared drive "tmp" to edit and update the sshd_config file, without needing to ssh into the box. (Obviously this is a foolish thing to enable, which is why it's only on a temporary share.) I've also taken the precaution of backing up the current file.
Next, editing the sshd_config file. I'm using vi so that I can edit on the NAS itself, rather than trusting CR-LF conversions via the network share (and because the NAS doesn't have emacs installed - but that's a whole other flamewar). As suggested by Myron, found the line
AllowUsers root
Changed it to
AllowUsers root pc-backup
(where pc-backup is the user ID I'll configured into my sftp client on the PC)
Finally enter the command
/etc/init.d/ssh restart
I didn't log out from that ssh session in case I'd broken it all. Instead I opened a new ssh and tried to log in as pc-backup: ssh access working perfectly. Logged on, home directory is /shares, standard unix permissions are preventing me from access shares (and other files) to which I shouldn't have access.
Try to log in with sftp: Working perfectly.
Happy ![]()
So now that I've enabled SSH for non-root, I decided to disable it for root. If I need root access, I can just ssh in as pc-backup (or create another account) and sudo/su to get root. Technically this is no more secure than logging in directly as root, but I don't like leaving remote root login enabled anywhere. Before I disable root login though, I need to make sure I can use sudo as pc-backup.
So alt-tab back to the ssh session in which I'm still logged on as root, find and edit the file /etc/sudoers
After the line
root ALL=(ALL) NOPASSWD: ALL
I added the line
pc-backup ALL=(ALL) ALL
Saved, exited, tested on my pc-backup ssh session before doing anything else. (This is unix, I know how badly it'll go wrong if I don't test everything every time I touch it) ![]()
Now back to /etc/ssh/sshd_config and the two lines
PermitRootLogin yes AllowUsers root pc-backup
become
PermitRootLogin no AllowUsers pc-backup
Another quick test, and I'm no longer able to ssh in as root, but I can ssh (and sftp) in as pc-backup, and if I need to I can use sudo to perform actions as root.
Sensible next step that I haven't tried yet:
http://blog.zioup.org//2008/iptables_recent/
I need to learn more about iptables first..
Final step: clear the backup and the symbolic link from the 'tmp' share.
All done ![]()
Re: attaching accounts to sftp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-14-2012 06:12 PM
I am waiting for my Rasberry PI ( http://www.raspberrypi.org/ ) to arrive so I can put Debian Linux image on a 4Gb SD card and play with Linux. It'll be perfect because I can try all sorts of stuff and I'm sure my exotic experemtation I plan will destroy the Linux OS many times over for me to just resurrect by just writing a factory default image back onto the 4Gb SD card.
I can try things on there before even begin to think about trying anything on the Duo, but to be honest I would prefer to leave the Duo's OS alone. I'll kust make sure that root's password is very difficult to guess. Like impossible to guess!
Re: attaching accounts to sftp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-14-2012 08:29 PM
Very sensible - I've been playing with Linux since the early 90s so although I don't necessarily know specific tools (e.g. OpenSSH and iptables) I'm confident about messing with the internals to a fair extent. Your approach is far more prudent and I wish I had that patience ![]()
Regarding root passwords, it would be trivial to disable root access via password and force use of an SSH key exchange. I decided against that as I'm at far higher risk of losing the key than I am of having my root password hacked. I'm also not going to post how to achieve it, partly because I can't test it (without doing it) and partly because it's so much more likely to leave the device unaccessible via ssh.
Re: attaching accounts to sftp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-15-2012 05:43 AM
Exactly. Me thinks it's better to practice and experiment on a sactificial installation of Linux and once proven and fully understood, to implement on the device that can be easily trashed and a wonderful thing about the Rasbery PI... There is a downloadable image of Debian Linux. ![]()
| Forums | Ideas | News and Announcements | Register | Sign in | Help | Forum Guidelines | |

