Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

closed as off-topic by HBruijn, Ward, MichelZ, mdpc, Tom O'Connor Jul 16 '14 at 23:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions must demonstrate a minimal understanding of the problem being solved. Try including attempted solutions, why they didn't work, and the expected results. See How can I ask better questions on Server Fault? for further guidance." – Ward, Tom O'Connor
If this question can be reworded to fit the rules in the help center, please edit the question.

Aren't you monitoring your servers? – Michael Hampton Jul 15 '14 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. – Belmin Fernandez Jul 15 '14 at 21:41
No, the remote host is not a server and NTP is not installed. Thanks. – user1762109 Jul 15 '14 at 21:46
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 '14 at 22:07
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 '14 at 22:12
up vote 5 down vote accepted

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.

share|improve this answer
Thanks but I'm trying to keep it simple. I'm looking for the equivalent of Windows "net time \\host" – user1762109 Jul 15 '14 at 22:11
@user1762109 That doesn't make any sense. "net time \\host" is a Windows command. – kce Jul 15 '14 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. – user1762109 Jul 15 '14 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 '14 at 22:15
I see. Thank you. – user1762109 Jul 15 '14 at 22:21

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.

share|improve this answer
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 '14 at 22:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.