mosh + osx + /bin/false error - macos

I have successfully installed mosh at server and client side both. I am trying to ssh using mosh from osx but it is throwing following error:
/bin/false: No such file or directory
write: Broken pipe
/usr/local/bin/mosh: Did not find remote IP address (is SSH ProxyCommand disabled?).
I am not sure if it has anything to do with mosh, or it is general error. Please help me in setting up mosh.

This error
/bin/false: No such file or directory
most likely means the user account that you are trying to login to is disabled. You need to log in as another user, and change the shell to a valid executable
$ chsh -s /bin/bash [username]

Related

Bash File Transfer Issue Using SCP

I need to transfer files from machine 'A' to machine 'B' and I'm executing the command from machine from 'C'.
Run Command :
$sshpass -p 'password_for_a' ssh -A -t a#x.x.x.x rsync -avz /home/test/* b#x.x.x.x:/home/test/
This prompts the "Password" for machine "B" which i do not want to type manually. I cannot install "sshpass" on machine "A" because i don't have authorization to install lib/packages.
Is there anyway to include the password using rsync/scp for the above command ?
I tried passing password using 'scp' 'PreferredAuthentications' too.
$sshpass -p 'password_for_a' ssh -A -t a#x.x.x.x scp -o PreferredAuthentications="password_for_b" /home/test/* b#x.x.x.x:/home/test/
I'm getting ,
Permission denied (publickey,password).
lost connection
If i am wrong anywhere , Please correct me ?
There is nothing like PreferredAuthentications="password_for_b". The authentication method is called password. If you specify something invalid, it obviously fails. Set up public key authentication.
Thanks All , I generated ssh-keygen and copied key files to (*.pub) respective machines. Now i can do password less authentications. Got clarify post discussions.

SCP file from ssh session to localhost

I have a headless file server on which I store and manage downloads and media, but occasionally I have to transfer small files back to my computer (Mac, using bash shell). The problem is that some files have more user-friendly names and commonly have spaces in them, and they are buried in the file directory hierarchy I have set up on my server.
When I'm using scp from my local machine, I don't have tab completion, so I have to manually type out the entire path and name with spaces escaped. When I ssh into the server first, the command:
scp /home/me/files/file\ name\ with\ spaces.png Me#localhost:/Users/Me/MyDirectory
fails with the error "Permission denied, please try again" even though I'm entering my local machine user password properly.
I've learned a little bit of sftp since I've been told that may be a better tool for file transfer. However, the utility seems outdated and I still don't have tab completion after establishing a connection to the server (on my Terminal when pressing Tab I just get a tab character).
My question is this: what can I do to allow tab completion while using scp from my Mac? Or am I using incorrect syntax for scp while in an ssh session, and is there something in that command I should fix? Or, is there a (better? newer?) tool other than sftp that would offer tab completion on a server?
Finally, if none of these problems have simple solutions, is there some package I could install (e.g. a completion package from Homebrew or the like) that would facilitate better tab-completion with any of these commands?
Looks to me like this is some incorrect scping.
This is the format of the command
scp ./localFile.txt remoteUser#remoteHost:/remoteFile.txt
You were so close, but you have localhost set where you should have your remoteHost.
localhost is the name that resolves to the machine that you are currently on - so in your workflow, you are sshing to a machine, and then trying to scp that file to the same machine you are already sshd into.
What you need to do, is figure out the IP address, or the physical host name of the computer that you are trying to connect to, and use that instead.
scp ./localFile.txt remoteUser#192.168.1.100:/remoteFile.txt
# where 192.168.1.100 would be the IP of your Mac
I am assuming the reason you were getting permission denied, was because you were using your the login credentials for you mac, but unknowingly trying to login again to your headless machine.

Connecting through ssh with out password prompt in shell script with password defined in script

I created a shell script which which uses ssh and it connects to many servers, I wanted my script to save the password of the servers in my script itself and connect to the servers automatically without any prompts, I am not concerned of security as of now.
I tried ssh -o PubkeyAuthentication=no -o PreferredAuthentications=Mypassword username#hostname
Its throwing an error Permission denied (gssapi-keyex,gssapi-with-mic,pubkey, password,keyboard-interactive)
I am using sun solaris UNIX server, I don't have privilege to install keygen or any changes in ssh files.
Thanks in advance.

How can I run a shell script via SSH such that the environment of the remote computer is similar to that of the local computer?

I welcome rephrasing of my question, because I'm not sure exactly what the problem is called.
I am trying to run a shell script via SSH using a command of the following form:
ssh -o StrictHostKeyChecking=no lxplus0035 "cd ~/test; bash script1.sh"
When I do this, the complex script script1.sh breaks with many syntax errors, operand errors and other errors. An example is as follows:
stty: standard input: Invalid argument
The script works fine when run directly, not via SSH, in the local system and in the remote system (when connected in an SSH session). Why might executing the script via SSH cause these problems?
The stty problem is not related to your environment, it's a result of the SSH command not allocating you a TTY (What is Pseudo TTY-Allocation? (SSH and Github)). Adding -t argument for ssh should fix it.
Further information:
http://go2linux.garron.me/linux/2010/11/ssh-t-open-pseudo-tty-run-commands-remote-server-809/
http://capistranorb.com/documentation/faq/why-does-something-work-in-my-ssh-session-but-not-in-capistrano/

X11 connection rejected because of wrong authentication

I am getting a error while accessing the firefox using X11Forwarding.
[root#station2 ~]# firefox
KiTTY X11 proxy: wrong authorisation protocol attemptedKiTTY X11 proxy: wrong authorisation protocol attemptedError: cannot open display: localhost:10.0
setup the following values: /etc/ssh/sshd_config
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
** Installed the package**
#yum install xorg-x11-xauth
#yum -y install xauth
[root#station2 .ssh]# echo $DISPLAY
localhost:10.0
#mkxauth -c
adding key for station2.example.com to /root/.Xauthority ... done
export XAUTHORITY=$HOME/.Xauthority
This fix worked for me
There is a hard, if not even impossible, to find (by search engine) scenario that may may cause that error message.
Preliminary note: The topic of this answer is not to discuss if it is a safety
risc or recommondable at all to use a graphical desktop as root on an remote, display-less, webserver.
Scenario:
A remote internet connected Linux server S has assigned the domain
name example.com to it's public IP4-address 192.0.2.1.
The /etc/hostname file on S contains the single line example.
The /etc/hosts
file on S contains the line 127.0.0.1 localhost example.com example.
The (remote) ssh access to S is by (sshd-) configuration (on S) forbidden
for root by the line DenyUsers root in /etc/ssh/sshd_config, but
allowed for a dummy user user1. From a client computer C a ssh
connection, using the ssh parameter -X or -Y, is established to S
as user user1.
Then, in a remote terminal on S owned by user1,
if any X11 related command is tried to be executed as root, may it be by
su, then trying to start the X11 desktop environment
or, as in the concrete case executing a script containing
#!/bin/bash
su --preserve-environment -c "xfce4-session &" root
the error message
X11 connection rejected because of wrong authentication.
is output and the start of any X11 related program fails.
The DISPLAY variable of root's environment contains
example.com:10.0
then.
One solution to the problem is, in this special case, to modify the line
127.0.0.1 localhost example.com example
in /etc/hosts to
127.0.0.1 localhost
Solution: run the application with the same user you are SSHing.
I have also encounter such errors while using X11.
The source of my problem was that i used SSH with my own username (which was not root).
Then, once logged in i tired running stuff with X11 while doing "su" or doing "sudo",
the problem with that is that the SSH session is configured with your own username - e.g: Raj, but then you switch to user root which is not part of the X11 session.
So what you should do is simply try to run the application (firefox in your case) with the same user you started the X11 session.
Hope this helps.
Talel.
I ran into this running gvim over ssh -t -Y and the solution that worked for me was:
xauth add $(xauth -f ~<logon_user>/.Xauthority list | tail -1) ; export NO_AT_BRIDGE=1 # gvim X11 fix for remote GUI failure after su
I do not know where I stumbled on this answer so I cannot give credit to the author.

Resources