Так sshкак не имеет опции для принудительного ввода имени пользователя; Вы можете создать следующий скрипт в вашем ~/binкаталоге и назвать его ssh:
#!/usr/bin/perl
my $user_at_address = $ARGV[0];
my @u_a = split(/@/, $user_at_address);
if (defined $u_a[1])
{
if ( $^O == 'linux' )
{
exec ("/usr/bin/ssh $u_a[0]\@$u_a[1]");
}
if ( $^O == 'solaris' )
{
exec ("/usr/local/bin/ssh $u_a[0]\@$u_a[1]");
}
}
else
{
print "Enter your username: ";
my $username = <STDIN>;
chomp ( $username );
if ( $^O == 'linux' )
{
exec ("/usr/bin/ssh $username\@$u_a[0]");
}
if ( $^O == 'solaris' )
{
exec ("/usr/local/bin/ssh $username\@$u_a[0]");
}
}
Затем сделайте скрипт исполняемым:
chmod 755 ~/bin/ssh
Убедитесь, что $HOME/binв вашем PATH(положить export PATH=$HOME/bin:$PATHв вашем ~/.bashrcили /etc/bashrcи source ~/.bashrcили source /etc/bashrc).
Затем запустите его так, как вы бы ssh:
[ 12:49 jon@hozbox ~ ]$ ssh localhost
Enter your username: bob
bob@localhost's password:
[ 12:50 bob@hozbox /home/bob ]$