0

I'm trying to create SSH tunnel between two VPS for Secure MySQL Replication. I follow these steps (read only Step 1: Setup SSH Tunneling): https://www.digitalocean.com/community/tutorials/how-to-secure-mysql-replication-using-ssh-on-a-vps Both servers are with Ubuntu 14.04 OS. The problem occurs when I try to create the tunnel on my Slave machine, when I run:

ssh -L 33061:localhost:3306 tunneluser@1.1.1.1 -f -N

I get this respone:

This account is currently not available.

I did some tests. If i try to connect from Slave to Master with

ssh 'tunneluser@1.1.1.1' //before to execute: usermod -s /sbin/nologin tunneluser

it works, so my keys are correct. It seems that the problem is in this step:

usermod -s /usr/sbin/nologin tunneluser

First time when I tried this it had been working fine, but I can't reproduce it againg. I'm using the same images of my VPS's, I follow same steps, there is no difference in the environmnet, what cloud be the problem?

vinsa
  • 101
  • 3

2 Answers2

0

You missed the line in the instructions you're following that said:

Debian and Ubuntu users replace /sbin/nologin with /usr/sbin/nologin

Your tunneluser account thus has no valid shell, and you can't log into it.

Mike Scott
  • 7,903
  • 29
  • 26
  • Actually I didn't, I did **/usr/sbin/nologin** as in tutorial. I have done mistake in my question, sorry, I will edit it, thanks. – vinsa Feb 28 '15 at 12:22
0

I found my mistake!

The problem was in MS Word, I saved all commands in a doc file and just copy and paste them. MS Word converts regular - to longer in some cases. So, this longer dash breaks my last command:

ssh -L 33061:localhost:3306 tunneluser@1.1.1.1 -f -N

OMG, I lost 8 hour about that!

masegaloeh
  • 17,978
  • 9
  • 56
  • 104
vinsa
  • 101
  • 3
  • *Very* common flaw, but extremely hard to detect. – sebix Feb 28 '15 at 14:29
  • Sheesh, don't use MS Word for this, for that reason and *many* others. There are plenty of very capable plain-text editors that will not try and do anything "clever" with your code like Word so helpfully does. – EEAA Feb 28 '15 at 14:48