Question about ssh

Question about ssh

am 03.10.2007 16:53:34 von olleicua

Hello,

I am a high school senior who helps out with administrating our
school's small computer lab. I'm looking into a way to easily
shutdown all of the Macs in our lab every night. Mac has a system
preference pane that allows you to start up and shut down on a
schedule. It turns out that the shutdown will only work if the
computer happens to be awake when that time comes. I tried using a
crontab but it had the same problems. I'm looking into a way to make
a script that simply SSHes into the rest of the computers and shuts
them down. This could be run manually at the end of every day. I
discovered that I could make a shell script by simply putting Unix
commands in a text file and execute it using the bash command. The
problem comes when I try to run ssh this way. I'm not sure how to
enter a password when I ssh in a file. The man page didn't help
much. Any ideas would be greatly appreciated.

Peace
~Sam Auciello

olleicua@gmail.com

Re: Question about ssh

am 03.10.2007 17:29:41 von Icarus Sparry

On Wed, 03 Oct 2007 14:53:34 +0000, olleicua wrote:

> Hello,
>
> I am a high school senior who helps out with administrating our school's
> small computer lab. I'm looking into a way to easily shutdown all of
> the Macs in our lab every night. Mac has a system preference pane that
> allows you to start up and shut down on a schedule. It turns out that
> the shutdown will only work if the computer happens to be awake when
> that time comes. I tried using a crontab but it had the same problems.
> I'm looking into a way to make a script that simply SSHes into the rest
> of the computers and shuts them down. This could be run manually at the
> end of every day. I discovered that I could make a shell script by
> simply putting Unix commands in a text file and execute it using the
> bash command. The problem comes when I try to run ssh this way. I'm
> not sure how to enter a password when I ssh in a file. The man page
> didn't help much. Any ideas would be greatly appreciated.
>
> Peace
> ~Sam Auciello
>
> olleicua@gmail.com

The standard way to get around the password entering is to use keys.

1) Generate keys using the ssh-keygen program.
2) Add the contents of the ".pub" file to the authorized2_keys file on
each of the target machines.

Then you can use ssh from a script without it needing a password.

Re: Question about ssh

am 03.10.2007 19:22:57 von Bill Marcum

On 2007-10-03, olleicua wrote:
> Hello,
>
> I am a high school senior who helps out with administrating our
> school's small computer lab. I'm looking into a way to easily
> shutdown all of the Macs in our lab every night. Mac has a system
> preference pane that allows you to start up and shut down on a
> schedule. It turns out that the shutdown will only work if the
> computer happens to be awake when that time comes. I tried using a
> crontab but it had the same problems. I'm looking into a way to make
> a script that simply SSHes into the rest of the computers and shuts
> them down. This could be run manually at the end of every day. I
> discovered that I could make a shell script by simply putting Unix
> commands in a text file and execute it using the bash command. The
> problem comes when I try to run ssh this way. I'm not sure how to
> enter a password when I ssh in a file. The man page didn't help
> much. Any ideas would be greatly appreciated.
>
Read the man page for ssh-keygen.

> Peace
> ~Sam Auciello
>
> olleicua@gmail.com
>