Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On my Red Hat 5.3 Linux machine, NTP isn’t installed (can't install it for some reasons).

However I can copy the binary /usr/sbin/ntpdate from another Linux machine to mine.

If I only get the file ntpdate and put it on my Linux machine under /tmp, is it possible to run

     /tmp/ntpdate -u 109.23.4.5

in order to update my date?

109.23.4.5 would be my Linux machine.

share|improve this question
    
Are you running RH 5.3? Or RHEL 5.3? Big difference. –  MikeyB Nov 18 '11 at 14:44
    
If it's a client's computer and the date/time is wrong, it's their problem, they should fix it. If you're not allowed to make changes to have it set the correct time automatically then it's really not your problem and shouldn't even be trying to correct it. –  Chris S Nov 18 '11 at 15:09

4 Answers 4

You can set the time manually on the server if you need using the date command. You can also download the ntp RPM package from the web or via yum. Copying binaries in this case is a bit of a kludgy hack. It's not a good practice.

However, you have not explained why you cannot install the ntp package on your server. If this is consistent with your other questions here, you are not given permission to make changes. If that's the case, this is not really a sysadmin problem.

share|improve this answer
    
I cant install NTP pkg - this isnt my linux machine , the sys belong to customor and we cant perfrom any install steps , why evry here cant answer on this? –  Diana Nov 18 '11 at 13:23
    
If it's not your system, then you can't really install packages. Set the date/time manually using the date command. date MMDDhhmm[[CC]YY][.ss] –  ewwhite Nov 18 '11 at 13:37
    
A) ewwhite is right in using date to just set the date, B) if you can't install things on the server, doesn't that mean you don't have root access and may be limited anyway in what you can do? –  Bart Silverstrim Nov 18 '11 at 15:07
    
In doing a quick test, ntpdate doesn't work as non-root since it can't bind to the port necessary. If you can't install things, I'm assuming you don't have root, so how would you run the date change? –  Bart Silverstrim Nov 18 '11 at 15:16

Usually, copying the binary file is not a good idea unless it is a portable and standalone binary. Binaries usually depend on several other binaries/libraries to be available such as shared objects in Linux and dll in Windows.

Also, the platform differences can prevent running the same binary.

Anyway, you can try to copy the binary and see if it will work or not. Maybe, copying it to your home dir is better than copying it to '/tmp'. Some secured systems may prohibit files execution from /tmp partition.

share|improve this answer
    
the resont to copy the file to /tmp is because I need to update the date only one time –  Diana Nov 18 '11 at 12:39
    
If /tmp doesn't allow execution of binaries, it doesn't really matter how many times you want to run it. It wouldn't work. Users are often limited to things in their own home directory when working on projects and such. –  Bart Silverstrim Nov 18 '11 at 15:06

What are the reasons that ntpdate (and its associated tools, rc scripts, etc.) can't be installed? Maybe it can be workaround somehow.

If you can copy the binary to /tmp filesystem, it will be probably deleted everytime the system boots. You could write simple rc script, which would copy ntpdate binary to /tmp and run that. But it seems really awkward.

share|improve this answer
    
the resont to copy the file to /tmp is because I need to update the date only one time –  Diana Nov 18 '11 at 12:39
1  
ntpdate is part of ntp package. If you can't install that package, you may try to compile it yourself. –  Martin Vejmelka Nov 18 '11 at 12:54
    
why you vote (-1)? –  Diana Nov 18 '11 at 12:58
1  
@Diana That was not me, who voted (-1), as my reputation in this forum is 1 and for downvote you need at least 125. –  Martin Vejmelka Nov 18 '11 at 13:29

You can check what dependencies a binary has using ldd

ldd /usr/sbin/ntpdate
    linux-vdso.so.1 =>  (0x00007fff1aed8000)
    libcap.so.1 => /lib64/libcap.so.1 (0x00002acf97303000)
    libc.so.6 => /lib64/libc.so.6 (0x00002acf97507000)
    /lib64/ld-linux-x86-64.so.2 (0x00002acf970e5000)

So if you have the required libraries then it should work. You could of course copy the libraries from another machine if they don't exist on yours (they likely do though).

Far simpler would be to use the date command like so

sudo date 111814282011.00

Which will set the date to the time provided 18th Novenmber 2011 14:22.00

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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