MOSH host on OS X

There is a great tool called Mobile Shell (mosh) that makes your SSH fast as a light.

It works great on both NIX and OS X systems but there is one sad thing that it can’t run as host on OS X “from the box” when you installing it via homebrew.

themengzor@AZ-MacBook ~$ mosh OSXhost
bash: mosh-server: command not found
Connection to OSXhost closed.
/usr/local/bin/mosh: Did not find mosh server startup message.

Everything because of $PATH variable. To fix that you must put /usr/local/bin in your $PATH variable in ~/.bashrc file:

$PATH="/usr/local/bin:$PATH"

ProFTPD 1.3.5 AuthUserFile issue and fix

After upgrading half of my Debian servers from 7.8 to Debian 8 I’ve got some strange error while trying to start ProFTPD version 1.3.5 with AuthUserFile parameter. But previous version of ProFTPD

root@server /etc/proftpd$ service proftpd restart
Job for proftpd.service failed. See 'systemctl status proftpd.service' and 'journalctl -xn' for details.

What Did You Say?

root@server /etc/proftpd$ systemctl status proftpd.service -l
proftpd.service - LSB: Starts ProFTPD daemon
Loaded: loaded (/etc/init.d/proftpd)
Active: failed (Result: exit-code) since Fri 2015-05-22 23:39:05 EEST; 2s ago
Process: 31660 ExecStop=/etc/init.d/proftpd stop (code=exited, status=0/SUCCESS)
Process: 31668 ExecStart=/etc/init.d/proftpd start (code=exited, status=1/FAILURE)
May 22 23:39:05 server proftpd[31668]: Starting ftp server: proftpd 2015-05-22 23:39:05,703 server proftpd[31674]: mod_auth_file/1.0: unable to use world-readable AuthUserFile '/etc/proftpd/auth.passwd' (perms 0604): Operation not permitted
May 22 23:39:05 server proftpd[31668]: 2015-05-22 23:39:05,703 debian8server proftpd[31674]: fatal: AuthUserFile: unable to use /etc/proftpd/auth.passwd: Operation not permitted on line 1 of '/etc/proftpd/conf.d/auth.conf'
May 22 23:39:05 server proftpd[31668]: failed!
May 22 23:39:05 server systemd[1]: proftpd.service: control process exited, code=exited status=1
May 22 23:39:05 server systemd[1]: Failed to start LSB: Starts ProFTPD daemon.
May 22 23:39:05 server systemd[1]: Unit proftpd.service entered failed state.

DA FUQ?

After half hour of googling I’ve found that everything is alright with the config files contents. So what is going on? Why it doesn’t work?

And you know what? It was a file permissions 🙂 Pretty obvious, you know.

Simply remove all permissions except of owner (0600) for passwd files and restart ProFTPD:

chmod 0600 *.passwd
service proftpd restart

Success

Mount SSHFS on OS X

If you want to have a fast and secure method to work with filesystem on remote machine that has only SSH you can choose SSHFS.

Installing SSHFS on OS X Yosemite is easy — use Homebrew to install OSXFuse and SSHFS:

brew install Caskroom/cask/osxfuse
brew install sshfs

Use this command to mount root volume of remote host (remotehost:/) to your local folder /Users/me/host and also create a volume with name LocalVolumeName. It will automagically reconnect on network fails and SSH timeout.

sshfs user@remotehost:/ /Users/me/host/ -o reconnect,follow_symlinks,volname="LocalVolumeName"

You will be asked for a password of the remote system and if you don’t want do enter that password each time you can setup SSH passwordless login.

To get your remote filesystem faster you can create simple BASH script:

#!/bin/bash
sshfs user@remotehost:/ /Users/me/host/ -o reconnect,follow_symlinks,volname="LocalVolumeName"

Save that as sshfs.sh and give it execute permission:

chmod +x ./sshfs.sh

After that you can launch your script from Terminal or Finder.
Actually, you can name it as you want (even DestroyEarth).