Command for SSH with @ in User Name


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Command for SSH with @ in User Name
# 1  
Old 06-16-2011
Command for SSH with @ in User Name

I am trying to log into a server using SSH through the command line. I understand that the format is sftp -oPort=22 Username@Hostname. My issue is that my user name also has an @ symbol in it. Can someone tell me how I can get the system to not think that the last half of the user name as part of the hostname.

For example, my username is user@name. My hostname is hostname. When putting in the command, I am using sftp -oPort=22 user@name@hostname. The results I am getting is a request for the password for name@hostname.

Any help you can give would be greatly appreciated.

davkatjenn

Last edited by davkatjenn; 06-16-2011 at 11:42 AM.. Reason: typo
# 2  
Old 06-16-2011
Did you give a try passing user@name in quote as 'user@quote'
# 3  
Old 06-16-2011
or user\@name@host.name
# 4  
Old 06-16-2011
would suggest you could either try escaping (sdfg\@fgh ) or quoting ('abcd@defg')


but since I'v never come across @ in a username before, out of interest, what OS are you on that allows "@" to be used as such?

:-)
# 5  
Old 06-16-2011
Usernames are never supposed to contain @, from man useradd:
Code:
       Usernames must start with a lower case letter or an underscore,
       followed by lower case letters, digits, underscores, or dashes. They
       can end with a dollar sign. In regular expression terms:
       [a-z_][a-z0-9_-]*[$]?

Many things are written to this spec.
# 6  
Old 06-17-2011
Thank you all for your suggestions. None of them worked. As to the OS question, I do not know the answer.

We found a way to make this work. Just in case anyone would like to know, now or in the future, I will detail what we did. We have tested this for Unix. I don't know how this will effect other systems.

In the .ssh folder on your server, create a file called config.
In that file, type the following:

Host <trading partner name i.e. bookstore>

HostName <actual hostname used for connection>
User <actual user name used for connection>
Port 22


Then, when you login from the command line, type sftp bookstore.
Press enter. The results will be a connection where it will tell ask you for the user@hostname's password.

davkatjenn
This User Gave Thanks to davkatjenn For This Post:
# 7  
Old 06-17-2011
That's a neat workaround. Have to remember that.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute ssh command with additional terminal command to any remote user not working script

Hello i am having an issue with bash script and this is the code now=$(cat hosts1.txt | awk '{print $2;}') while read n ;do ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers' When i execute only part with cat, it... (8 Replies)
Discussion started by: tomislav91
8 Replies

2. UNIX for Advanced & Expert Users

Passwordless ssh for different user

Hello Folks, I lost touch in ssh key gen topics. I am in need of ssh to a server without password, kindly help me in configuring. I have two servers, server1 with user name apha & server1 with user name beta. I need to ssh to the server2 from server1 with respective users, Manually i... (3 Replies)
Discussion started by: Thala
3 Replies

3. HP-UX

Restrict ssh for particular user

Dear Concern, We want to restrict ssh for particular user "oracle". Our HP UX version is as below. Please advise. # uname -a HP-UX tabsdb02 B.11.31 U ia64 2963363594 unlimited-user license (2 Replies)
Discussion started by: makauser
2 Replies

4. Programming

Trying to ssh as another user and cd to directory

I can ssh to another directory by doing the following: for server in server1; do ssh -t $server1 "cd /tmp; 'ls'";done However, if I try to do it as another user it fails: I have tried: for server in server1 do dir=$(su - nbadaccount -c "ssh $server `cd '/tmp/TSTCON'` " ) pwd... (3 Replies)
Discussion started by: newbie2010
3 Replies

5. UNIX for Dummies Questions & Answers

SSH: don't specify a user

How can I tell ssh to ask for the username at the prompt instead of passing one in via the -l parameter or $username@$server on the command line? I know that when I connect to an ssh server via putty, if I don't specify a username when connecting, the ssh server will ask for the username. I'm... (1 Reply)
Discussion started by: dangral
1 Replies

6. AIX

passwordless entry using ssh from one user to a different user on the same server

Hi, We have a requirement to do passwordless entry from one user to a different user on the same AIX server using ssh keys. Can some one help me with this? Thanks in advance, Panditt (3 Replies)
Discussion started by: deshaipet
3 Replies

7. Red Hat

Cannot ssh for a user

This is the entry when I tail /var/log/secure when I ssh for user "nightly"... Aug 4 03:19:48 itanium2 sshd: Illegal user nightly from ::ffff:10.91.220.35 Aug 4 03:20:10 itanium2 sshd: Failed password for illegal user nightly from ::ffff:10.91.220.35 port 32862 ssh2 What could be... (3 Replies)
Discussion started by: kirtikjr
3 Replies

8. UNIX for Dummies Questions & Answers

change user> to user@host> ssh prompt

Hi, I was wondering how to change the prompt for my ssh login. At the moment it is like user> while I'd like it to be as user@host> It is in the .bash_profile or .ssh ??? Thanks (2 Replies)
Discussion started by: pmasterkim
2 Replies

9. Shell Programming and Scripting

root user command in shell script execute as normal user

Hi All I have written one shell script for GPRS route add is given below named GPRSRouteSet.sh URL="www.google.com" VBURL="10.5.2.211" echo "Setting route for $URL for GPRS" URL_Address=`nslookup $URL|grep Address:|grep -v "#"|awk -F " " '{print $2}'|head -1` echo "Executing ... (3 Replies)
Discussion started by: mnmonu
3 Replies

10. Shell Programming and Scripting

How to use ssh command in the shell script without user intervention?

Hello All, I need your help, i would like to know how to use ssh command in the shell scripts? and make the script continue to enter the password without user intervention example of the normal commands written manually: # ssh 172.30.1.256 -l mxread password: mxread Thanks in advance (3 Replies)
Discussion started by: Dendany83
3 Replies
Login or Register to Ask a Question