$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/bob/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/bob/.ssh/id_rsa. Your public key has been saved in /home/bob/.ssh/id_rsa.pub. The key fingerprint is: SHA256:LCWI8Wrw14m0Cxz1P+TqmL7Nn+mY19fWETCfjYK87VY bob@bob-ThinkPad-SL510 The key's randomart image is: +---[RSA 2048]----+ | . . . | | = o o o | |. o + o +. . +.o| | + + + B .o . .+.| | * + = S o . .| | . o = . . . E. | | + . . . o ..| | . o o.o. + o .| | o.=+= o . | +----[SHA256]-----+ $ #### values are home349337426.1and1-data.host The authenticity of host 'home349337426.1and1-data.host' can't be established. Key fingerprint is SHA1:6bfe32c8859a967c8ed6cebdd5c48b72edff71c7. Are you sure you want to continue connecting (yes/no)? y mkdir is not a valid Net::SSH2 macro at ssh4.pl line 31. $ $ #### #!/usr/bin/perl -w use strict; use Net::SSH2 qw(LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE LIBSSH2_CHANNEL_FLUSH_ALL LIBSSH2_HOSTKEY_POLICY_ASK); use 5.010; use lib "template_stuff"; use config2; # none of this makes any sense until you run # ssh-keygen -t rsa my $sub_hash = "my_sftp"; my $domain = $config{$sub_hash}->{'domain'}; my $username = $config{$sub_hash}->{'username'}; say "values are $domain"; my $pass = "ringo"; my $ssh2 = Net::SSH2->new( debug => 1 ); $ssh2->trace(-1); $ssh2->timeout(5000); $ssh2->connect($domain) or $ssh2->die_with_error; $ssh2->check_hostkey(LIBSSH2_HOSTKEY_POLICY_ASK); $ssh2->auth_publickey($username, '/home/bob/.ssh/id_rsa.pub', '/home/bob/.ssh/id_rsa', $pass ); my $success = $ssh2->mkdir("perlmonks"); say "success is $success"; return 0; __END__