SSH w/ command in authorized_keys apparently needs pty


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SSH w/ command in authorized_keys apparently needs pty
# 8  
Old 07-09-2011
The usual method of figuring out anything's IP address would be a DNS server. Just because you have a dynamic one doesn't rule this out... There's free DNS hosting available from various places, and your computer would keep the DNS entry updated by running a small monitor script.

Keeping going with your current solution, if you don't want it to use ssh-agent, you can just undo the environment variables ssh-agent sets:

Code:
export SSH_AGENT_PID=""
export SSH_AUTH_SOCK=""

# 9  
Old 07-09-2011
It's not that I don't want to use ssh-agent, it's that you have to be present after a reboot to type in the passphrase to unlock the secret key to use it. The nature of a remote system is that I won't be present.

But, actually, I think this might work after all. I killed ssh-agent and ran ssh (the remote computer isn't remote yet--it's right here), and it did indeed use the key I specified and I think it executed the bash script I set "command" equal to in that test.

I have to experiment some more to see if it really will do just what I need.
# 10  
Old 07-09-2011
Quote:
Originally Posted by KenJackson
It's not that I don't want to use ssh-agent, it's that you have to be present after a reboot to type in the passphrase to unlock the secret key to use it. The nature of a remote system is that I won't be present.
Well, sure, but you had the agent going anyway, and it messed up your program. I'm just telling you how to force it not to use ssh-agent without actually killing the agent. You can easily save the values for later if you want to put them back.
# 11  
Old 07-09-2011
Yeah, I know about DynDNS, no-ip, ChangeIP and others.

I thought about that at one point, but I wanted to do it this way instead.
Though I guess I'll look into that if I can't get this to work.

---------- Post updated at 04:57 PM ---------- Previous update was at 04:54 PM ----------

Quote:
Originally Posted by Corona688
I'm just telling you how to force it not to use ssh-agent without actually killing the agent.
Ah! I see. I'll have to try that when I get back to it.
# 12  
Old 07-11-2011
How to find DHCP IP and update

I have a similar problem and I have a solution that I've used for many years and has worked without much of a glitch.

First on my home server I have lynx installed, using it I have a script to get the ip by calling w w w . whatismyip . com (or another of the IP services), then I send an eMail with it and I update my home page on the homepage served by my ISP for my server.
# 13  
Old 07-11-2011
Quote:
Originally Posted by dajon
First on my home server I have lynx installed, using it I have a script to get the ip by calling w w w . whatismyip . com (or another of the IP services), then I send an eMail with it and I update my home page on the homepage served by my ISP for my server.
My favorite such site is queryip.net/ip/ because you don't have to use lynx or much of a script to scrape the IP. The IP address is all that's returned. Here's the whole script:
Code:
IP=$(curl -s http://queryip.net/ip/)
# or
IP=$(wget -q -O- http://queryip.net/ip/)

Also, if your ISP maps your address to a URL (most do), you can get it this way:
Code:
URL=$(curl -s http://queryip.net/url/)

Emailing it to myself is, of course, an option. I did that one place, but email turned out to be more fragile than I would have guessed. I have to authenticate myself to my ISP, so I must store my email password on the remote, and there's a third party involved with a not-very-trivial protocol.

I was hoping this would be simpler. Actually, I have it working well enough to achieve my purposes, but after I started working on it, I decided to expand it to a general logging capability. But that's not working. But I don't really need that, so maybe I'll let well-enough alone.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Ubuntu

Help me to revert the file /root/.ssh/authorized_keys

Hi, I copied the key of rsa.pub to authorized_keys using the below command cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys By mistake i have executed another command view cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys so now additional keys are copied.so please help me... (3 Replies)
Discussion started by: SA_Palani
3 Replies

2. Shell Programming and Scripting

Appending authorized_keys on multiple servers using ssh

Hi I have an ssh 'for' loop script to login and put a key on multiple servers. I need to append a file on each server but the command which works ok from the prompt does not work via the script. I have cat filename | ssh user@servername "cat >>append.file.name" I have tried to 'spawn' this in... (0 Replies)
Discussion started by: Grueben
0 Replies

3. Post Here to Contact Site Administrators and Moderators

Apparently my post is Homework/Classwork?

I previously posted a question in the Shell Scripting forum a few minutes ago. I recieved a message telling me I had breached a rule, apparently because my post was a homework infraction. Well, im currently trying to figure out how to use Raspberry Pi's (as im a starter) I asked one of my... (1 Reply)
Discussion started by: Waggie14
1 Replies

4. Programming

Race condition with PTY

I've been experimenting with pseudo-terminals and found something I don't quite understand. Writing an EOF character to the master end doesn't work quite as I expect. Once I've written any other data, the master pty seems to treat a single ^D as a seperator, i.e. writing "abcabc" would let cat do... (1 Reply)
Discussion started by: Corona688
1 Replies

5. UNIX for Dummies Questions & Answers

use of tty and pty files

Hi, According to my understanding tty files that are available in /dev directory are terminals that are given to different users. please help me understand what are /pty files, like are they drivers to the devices.. also is the default tty terminal given to a user.. (2 Replies)
Discussion started by: saharookiedba
2 Replies

6. UNIX for Advanced & Expert Users

monitoring SSH authorized_keys

Hi, We have around 200 SUN Servers in production environment and I have one box from where I manage all the servers. It's setup such that I can SSH from my box onto all the 200 servers with without supplying password. It is working fine but sometimes we notice the keys getting changed and asking... (1 Reply)
Discussion started by: prvnrk
1 Replies

7. Shell Programming and Scripting

monitoring SSH authorized_keys

Hi, We have around 200 SUN Servers in production environment and I have one box from where I manage all the servers. It's setup such that I can SSH from my box onto all the 200 servers with without supplying password. It is working fine but sometimes we notice the keys getting changed and asking... (0 Replies)
Discussion started by: prvnrk
0 Replies

8. Programming

good example for pty usage ?

i am looking for a good example to explain *why* someone should use pty's. (3 Replies)
Discussion started by: grumpf
3 Replies

9. AIX

How to monitor pty

Hi all, today I could not telnet in AIX 5.2 cause I received the error "telnetd: All network ports in use". To allow users to telnet again I increased the number of ptys from default 256 to the new number 512. To avoid the same problem in the future and for a better understanding, I need... (2 Replies)
Discussion started by: l-roner
2 Replies
Login or Register to Ask a Question