Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8375171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:06:19+00:00 2026-06-09T15:06:19+00:00

I have the following command to check if remote client permits to log in

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:06:21+00:00Added an answer on June 9, 2026 at 3:06 pm

    Add a command to be executed on the other side.

    I typically use : or echo ok. The first one should not produce any output, and I like error messages.

    remote_account=$REMOTE_HOST_USER@$REMOTE_HOST_IP 
    
    ssh -o PasswordAuthentication=no $remote_account : 2> /dev/null
    

    or

    ssh -o PasswordAuthentication=no $remote_account echo ok | grep ok
    

    The rest of your question is not very clear.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the following command to check how many connections I have from a
I have found the following command in AWK useful in Vim :'<,'>!awk '{ print
I have the following awk command which works perfectly: awk 'BEGIN { ORS =
I have the following SQL command that I need to save as a csv
I have a setup.exe project that I run with the following command-line arguments to
I have a MySQL innodb database at 1.9GB, showed by following command. SELECT table_schema
I have the following function that deletes the LaTeX command surrounding the current cursor
I have created a certificate using the following SSL command: makecert -r -pe -n
I have the following code. I am trying to bind the Command property of
I currently have a .command file for Mac that contains the following: for f

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.