I have the following command to check if remote client permits to log in with ssh without pass
ssh -o PasswordAuthentication=no \
$REMOTE_HOST_USER@$REMOTE_HOST_IP 1>/dev/null 2>/dev/null
Command is executed and if permission=no I am setting permissions at the rest of code. By the way “permissin denied message is sent to /dev/null”. But when the second time I execute my command, this time permission=yes and I must be log in to machine but it hangs of because I think there is no error or output. Cause I tried it like when I got the permission in code;
ssh -o PasswordAuthentication=no $REMOTE_HOST_USER@$REMOTE_HOST_IP
this time works.
So how can i arrange it to send error message for the first time and not to sent at rest
EDIT: As I can explain simple, my questin is that, say i have a command in my script that is possible to give error first time I run my script so i dont want to see erorrs and output and I run it as
command 1>/dev/null 2>/dev/null(it is in my script)
when i run script second time, the command will not give errors and output becaue i made some operations so it does no error.but when it is run second time it hangs becaue of /dev/null(i think so). because when it runs without /dev/null it works fine
Add a command to be executed on the other side.
I typically use
:orecho ok. The first one should not produce any output, and I like error messages.or
The rest of your question is not very clear.