- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Perl-SSH & permissions
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-08-2005 09:03 PM
тАО09-08-2005 09:03 PM
I have a small problem with ssh. I am using the Perl-SSH module to connect to a server and runa command. But I get:
Permission denied (publickey,gssapi,password,keyboard-interactive).
problem is that I don't know how to create this public key and how to use it in my code. It would be great if somebody can show me a link to read or a small example. Here is my code(same as example):
_______________________________
#! /opt/perl5/bin/perl
use Net::SSH qw(sshopen2);
use strict;
my $user = "root";
my $host = "hpserv";
my $cmd = "ls";
sshopen2("$user\@$host", *READER, *WRITER, "$cmd") || die "ssh: $!";
while (
chomp();
print "$_\n";
}
close(READER);
close(WRITER);
______________________________
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-08-2005 09:09 PM
тАО09-08-2005 09:09 PM
Solutionhost1# ssh root@host2 ls
To do this: -
On host1: -
cd ~/.ssh
shh-keygen -f id.rsa -t rsa
(enter a blank passphrase when asked)
copy the contents of the public key file id.rsa.pub to host2, then
On host2: -
cat id.rsa.pub >> ~/.ssh/authorized_keys
Basically you are generating an id.rsa and id.rsa.pub on the "local" machine, then adding the public key to the authorized_keys list on the "remote" host, to allow access.
This procedure assumes you have a ~/.ssh directory on each host. If you do not, then simply ssh somehost on each box and this will create it with the correct permissions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-08-2005 09:59 PM
тАО09-08-2005 09:59 PM
Re: Perl-SSH & permissions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-08-2005 10:04 PM
тАО09-08-2005 10:04 PM
Re: Perl-SSH & permissions
PubkeyAuthentication no
This will disallow public key authentication.
It this is set to yes (or commented out, yes is the default value), then check syslog for any errors. Chances are it's something like directory permissions (sshd is fussy about home directory permissions as well as .ssh directory and authorized_keys/id_rsa files etc).
Please post any relevant error messages.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-08-2005 10:14 PM
тАО09-08-2005 10:14 PM
Re: Perl-SSH & permissions
# chown -R logname ~/.ssh
# chmod 700 ~/.ssh
# chmod 600 ~/.ssh/*
# chmod +r ~/.ssh/*.pub
On both machines
Then please check if it works from the command prompt with ssh and scp before digging into perl failures
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-08-2005 10:40 PM
тАО09-08-2005 10:40 PM
Re: Perl-SSH & permissions
If I succeed I will post.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-11-2005 10:03 AM
тАО09-11-2005 10:03 AM