Hi folks. Your friendly neighborhood Linuxnoob here. Don't laugh at me.
I recently started messing around with SSH, which is really a topic I don't know much about. I thought I'd never need to use it, but now I'm starting to see its usefulness even in a home network.
I've got it working quite well on my home network, and I'll likely use it to make a secure media/file server, but one issue in particular that's cropped up during this has me a little concerned.
I only want to be able to log into one account remotely. My laptop has my main account and one I named "sshs" (SSH server) for test purposes. This is probably going to be a similar setup when I do commit to setting up an actual server - I'll have an admin account with full sudoers permissions, etc, and one that's available for SSHing in and grabbing files from its home directory.
I set "AllowUsers" and "DenyUsers" to allow the sshs account and deny the main account respectively on the server, and this works perfectly when SSHing in through a terminal. It denies access when I try to log in from the netbook as the main account.
But if I go "Connect to server" on my (Ubuntu, btw) netbook, in the filemanager, set my username and password as the already denied main account, and hit enter? Bang, I'm in on my main account.
Even more worrying, I can see the terminal session on the host machine's process list and user list (the "w" command displays their shell session) but again only if the remote computer has logged in through a terminal. Connecting through the "Connect to server" option effectively makes the remote user invisible and I can't kick them. Definitely do not want.
Finally, I was a smartypants and made a few scripts for shutting down, restarting, reporting the status of the SSH daemon on the server. But when someone is connected through the file manager as above, I can kill the SSH service (su -/sudo service ssh stop) and yet the remote computer can still navigate the server, and create, delete, modify files! This is after I have stopped the ssh service ("service ssh status" indicates it's definitely stopped). So I can't even do THAT. Nothing aside from disconnecting entirely from the network stops someone connecting in this manner. Heck, I even tried to slam the firewall down, but if they're already connected it doesn't seem to matter.
Anyone have a clue what's going on here? Is there a different configuration for ssh terminal connections and "sftp" connections using a file manager or browser?
- Someone connecting remotely with SSH using the file manager's SFTP "Connect to server" option can log in as any account apart from root
- They're invisible to the host machine
- Almost nothing can kick them or rescind access.
Pretty big security holes, heeeelp!
Also, while I appreciate any advice like "Don't use SSH for this, use _____!", I also need to get this sorted out. Never know when I might need to know what's going on in the future. I know I can limit connections to certain IPs using firewalls, the hosts.allow/deny files, but even still this behavior strikes me as something to fix.
Oh, and yep, I'm probably gonna use Linux Mint for the server - not run it as something like a headless FreeBSD or a Windows Server. Hey, what if I want to log onto it, into something awesome like MATE or Cinnamon, and do something?