LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-08-2011, 11:34 PM   #1
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Rep: Reputation: 145Reputation: 145
Can't get authorized_keys command="..." to work (SSH)


I'm trying to have an unattended remote PC log some data on my home PC.
According to man sshd, I should be able to put a command in authorized_keys.
The key I'm using is a special key that isn't used elsewhere.

In my ~/.ssh/authorized_keys file on my desktop:
Code:
command="/bin/cat >> /home/user/text/limited.log" ssh-dss AAAAB3Nz ...
Then to write the data, I issue this command on the remote machine, where desk_pc is the IP of my desk PC:
Code:
echo "$(date +%D)  Data ...." | ssh -x -i ~/.ssh/special_id_dsa desk_pc
This doesn't work.
I think my desktop it's trying execute the received text instead of cat it to the log file. This is displayed on the remote machine:
Code:
Pseudo-terminal will not be allocated because stdin is not a terminal.
-bash: line 1: 07/09/11: No such file or directory
Do I need a pty? How can I get stdin written to a file without a pty if I need one?

How do I get it to execute the /bin/cat command, not the received text?
 
Old 07-09-2011, 09:15 AM   #2
jv2112
Member
 
Registered: Jan 2009
Location: New England
Distribution: Arch Linux
Posts: 719

Rep: Reputation: 106Reputation: 106
Lightbulb



Try copying your id idenity.pub file to the remote server. This should allow you to ssh without a password.

Quote:

ssh-copy-id user@remoteserver
If it does not work after that you may also need to check permissions.

For passwordless authentication to work four criteria need
to be matched:
a) ~/.ssh *must* be 0700.
b) ~ must *not* be world or group writable.
c) ~/.ssh/authorized_keys on the target machine needs to be 0600
d) ~/.ssh/id_{dsa,rsa} must be 0600

Hope this helps.
 
Old 07-09-2011, 11:20 AM   #3
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Original Poster
Rep: Reputation: 145Reputation: 145
Accessing the remote is no problem. I already have a password protected .pub file that I had previously appended to the remote's ~/.ssh/authorized_keys file.

The problem is too much access. I added -v to the ssh line in my experiment and found that ssh lists both the key I specified on the command line with -i and the other key which is held in memory in decrypted form by ssh-agent. Then ssh ignores my stated request and chooses the one it wants.

Apparently you can only say "use this one, please", not "use this one, damnit".
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] openssh-server doesn't check into "authorized_keys" file ClemSF Debian 11 07-24-2010 08:52 PM
Supplying "password" to "ssh" command paragkalra Linux - Networking 1 07-31-2008 05:19 AM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
using root with ssh 'command=' and authorized_keys hank43 Linux - Security 1 09-11-2006 05:51 AM
Any way to get "Alice"; "Call of Duty" series and "Descent 3" to work? JBailey742 Linux - Games 13 06-23-2006 01:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration