Results 1 to 2 of 2

Thread: Using the watch command remotely

  1. #1
    Join Date
    Dec 2008
    Location
    Phoenix, Arizona
    Beans
    105
    Distro
    Ubuntu 12.04 Precise Pangolin

    Using the watch command remotely

    What I am trying to do is use watch to see who is logging into my server and who is attempting to log into my server. But do this all as part of a script.

    (I omitted my server address and password for obvious reasons)
    Code:
    omega@desktop:~$ ssh SERVER "echo 'PASSWORD' | sudo -S watch 'netstat -nap | grep EST'"
    [sudo] password for omega: Error opening terminal: unknown.
    If i lose the watch command it works fine, the problem is, then I have to call the command every 2 seconds, including reloggin into the server via ssh.

    Its the whole "Error opening terminal:unknown" that gets me.

    Any idea?
    Windows and Ubuntu can be used in harmony, both have advantages, both disadvantages.

  2. #2
    Join Date
    Jan 2009
    Location
    Flanders
    Beans
    Hidden!

    Re: Using the watch command remotely

    Can't you set up ssh with a passwordless key? That would be way safer than providing your password in a plain text file: https://wiki.archlinux.org/index.php/SSH_Keys

    But I don't think that's the way to execute commands remotely. You're not piping anything.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •