Ssh fails due to argument position.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Ssh fails due to argument position.
# 1  
Old 11-21-2018
Ssh fails due to argument position.

I have a constraint to follow organization policy. So i do not have much liberty.

ssh -i /opt/nonprod user1@hostone -t bash works while ssh -i /opt/nonprod -t bash user1@hostone fails

How can I get this to work when I am enforced to put -t bash before the user@hostname ?

Will share debug output as required.

Please Help !

Last edited by mohtashims; 11-21-2018 at 03:25 PM..
# 2  
Old 11-21-2018
You can't. The policy is wrong.

You can move the -t (which has nothing to do with the bash bit), but not the bash.
# 3  
Old 11-21-2018
Quote:
Originally Posted by Corona688
You can't. The policy is wrong.

You can move the -t (which has nothing to do with the bash bit), but not the bash.
I cannot move it as there is a third party tool that constructs the ssh which I have no crontrol over.

Cant we get -t bash before user@host to work ?
# 4  
Old 11-21-2018
Code:
SSH(1)                  Gentoo General Commands Manual                  SSH(1)

NAME
     ssh - OpenSSH SSH client (remote login program)

SYNOPSIS
     ssh [-1246AaCfgKkMNnqsTtVvXxYyz] [-b bind_address] [-c cipher_spec]
         [-D [bind_address:]port] [-E log_file] [-e escape_char]
         [-F configfile] [-I pkcs11] [-i identity_file]
         [-L [bind_address:]port:host:hostport] [-l login_name] [-m mac_spec]
         [-O ctl_cmd] [-o option] [-p port]
         [-Q cipher | cipher-auth | mac | kex | key]
         [-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
         [-w local_tun[:remote_tun]] [user@]hostname [command]

You can put -t almost wherever you want, but the command must always be at the end.

Perhaps their policy is meant to prevent you from doing what you are attempting to do - run remote commands via ssh.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SSH is failing due to unknown reason

Hi, I have setup keys between user1@server1 and user2@server2 however, the ssh is failing. server1 is Linux 3.10.0-514.6.2.el7.x86_64 #1 SMP whereas server2 is 5.10 Generic_150400-40 sun4v sparc sun4v I have checked port 22 to be open and keys to be correct. I also find the permissions... (3 Replies)
Discussion started by: mohtashims
3 Replies

2. Shell Programming and Scripting

Ssh failing due to Bad owner error

i am logged in with "user1" on host1. I m trying to ssh to host2 using user id "user2" $ ssh user2@host2 Bad owner or permissions on /home/user1/.ssh/config Question 1: Can you please tell me why am i getting the Bad owner permissions error on that directory ? Question 2: Where is it... (7 Replies)
Discussion started by: mohtashims
7 Replies

3. UNIX for Advanced & Expert Users

OEL 6.3 :Slow login due to /etc/ssh/sshd_config configuration

Version: Oracle Enterprise Linux 6.3 Running on VMWare Workstation When I login to my Linux VM from putty, the third line prompting for password comes only after few seconds. login as: root Access denied root@192.168.0.235's password: ---> It takes around 5 seconds to get this prompt I... (1 Reply)
Discussion started by: John K
1 Replies

4. Shell Programming and Scripting

Record length check fails due to '\' character

When I check the length for the records in the file, it does not give me the correct value. I used wc -l command. Example records: abcdefghij abcd\efghij abcdefghi Expected output is: 10 11 9 But the output returned is 10 10 9 Please help me on this issue. (10 Replies)
Discussion started by: Amrutha24
10 Replies

5. Ubuntu

Passwordless ssh authentication fails

Unable to set ssh passwordless authentication I am unable to ssh with passwordless authentication from Windows client onto UBuntu server. The ssh version on UBuntu is OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e , while SSH on Windows Client is OpenSSH_5.1p1, OpenSSL 0.9.8k. I turned on ssh... (5 Replies)
Discussion started by: tkota
5 Replies

6. OS X (Apple)

Compiling fails due to space in path to home folder

I seem to have issues compiling software and I think I've narrowed it down to something having to do with having a space in the path name to my Home folder (which contains "Macintosh HD"). The reason I think this is shown here: $ echo $HOME /Volumes/Macintosh HD/Users/Tom $ cd $HOME -sh:... (7 Replies)
Discussion started by: tdgrant1
7 Replies

7. Shell Programming and Scripting

UNIX script abruptly ending due to ssh command

Below UNIX script abruptly ends while reading second line from file. When I comment 'ssh' command the script works as expected. I think I will have to run ssh command in a different process, but haven't got a handle yet as regards to how to do that. Any help in resolving this problem is highly... (1 Reply)
Discussion started by: jeeteshkc
1 Replies

8. Shell Programming and Scripting

how do i avoid system hang due to ssh in script?

I have a script that collects data from about 200 servers using 'ssh'. The problem is that, process sometime hangs at some point stopping the execution of the script. Please give me some idea how can I force the execution to jump to the next step if there arises any problem !! Thanks for replies if... (1 Reply)
Discussion started by: mdangol
1 Replies

9. Shell Programming and Scripting

Need Help with expect when ssh fails

I'm trying to write a script using expect. I'd like the script to execute several commands when the ssh succeeds and i want it to exit if the ssh fails. Does this require to define a time out for the ssh command so that if the prompt is back before this defined time the next commands are executed??... (2 Replies)
Discussion started by: Hossam_Nox
2 Replies

10. Shell Programming and Scripting

find: No match due to find command being argument

I am using csh and getting the error "find: No match." but I cannot figure out why. What I am trying to do is set the find command to a variable and then execute the variable as a command. I ran it through a debugger and it looks like $FIND is getting set but the find command can not actually be... (2 Replies)
Discussion started by: mst3k4l
2 Replies
Login or Register to Ask a Question