1

I'm trying to find a Windows command that retrieves the current time of a remote Linux\UNIX host. I know I can use ssh but I'd like to know for alternatives that do not require user and password.

There's no time server in this environment.

Thank you

7
  • Aren't you monitoring your servers? Jul 15, 2014 at 21:35
  • The best way to do it would be using the Windows equivalent of ntpdate --query. Maybe something like snmp would work too if you don't have an ntp daemon on the box. Jul 15, 2014 at 21:41
  • No, the remote host is not a server and NTP is not installed. Thanks. Jul 15, 2014 at 21:46
  • 1
    So if the remote system is not a server how are you expecting to magically get the time? If you want get time, you need to make it an ntp/sntp server. Or if you are living in the dark ages you could install inetd and enable the time service (tcp/37).
    – Zoredache
    Jul 15, 2014 at 22:07
  • 4
    Then you would need to install the Samba server, and setup the Linux host to be a domai member. NTP would be easier though.
    – Zoredache
    Jul 15, 2014 at 22:12

2 Answers 2

5

It sounds like you are trying to solve the symptom and not the problem.

I would suggest that a time sever hierarchy in your organization would be the appropriate and professional approach and that the effort it would take to either implement a monitoring system (which you will want eventually) or hack together some kind of script with cywgin to check to make sure your remote Linux/UNIX host/s are using the correct time would be better spent on implementing a true solution.

4
  • 1
    Thanks but I'm trying to keep it simple. I'm looking for the equivalent of Windows "net time \\host" Jul 15, 2014 at 22:11
  • 1
    @user1762109 That doesn't make any sense. "net time \\host" is a Windows command.
    – user62491
    Jul 15, 2014 at 22:11
  • I know it's for Windows only. I'm wondering if there's any equivalent command that can retrieve the current time for a remote Linux host. Without time server, ntp or ssh\rsh credentials. Thanks. Jul 15, 2014 at 22:13
  • See you are confused. The 'net time' comes from the Server Service running on your Windows Desktop. Windows IS running a server, and it is authenticated via NTLM|Kerberos. Linux comes with no servers configured out of the box, so you can't just magically get the time.
    – Zoredache
    Jul 15, 2014 at 22:15
2

For the enlightenment of those supplying the comments: in the old unix days (mid 1980s), certain ports could be queried via inetd for responses: for example, "finger" would be able to provide information about a user on a remote host. The OP of this thread is basically asking if there is a similar way that one can obtain the date/time of a remote Linux host.

Yes, in the old days there was a similar service called "daytime" provided by inetd. You need to set up an inetd or xinetd service on the host and enable this service. Then you can connect to it over tcp or udp and it will respond with the local date/time on the host.

1
  • I am guessing you are talking about my comments, I did mention inetd and time (rfc868), which returns the a binary representation of time. daytime is the human readable version. But in any-case this does require enabling a server service, which the OP seemed to want to avoid for some reason.
    – Zoredache
    Jul 15, 2014 at 22:55

Not the answer you're looking for? Browse other questions tagged .