Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can you fake *nix uptime?

Just curious, Can you fake an uptime, for instance increase it to 10 years?

I have tried changing system time, and it won't do this trick.

like image 684
c2h2 Avatar asked Feb 14 '11 10:02

c2h2


People also ask

What does proc uptime show?

Using /proc/uptimeThe first number is the total number of seconds the system has been up. The second number is how much of that time the machine has spent idle, in seconds. On multi core systems (and some Linux versions) the second number is the sum of the idle time accumulated by each CPU.

Which two files does uptime read?

You can also read the /proc/uptime file to get the system uptime. /proc is a virtual or pseudo-filesystem, also known as a process information pseudo-filesystem. It contains information about the system and the processes it's currently running.

What does Linux uptime show?

Uptime Command In Linux: It is used to find out how long the system is active (running). This command returns set of values that involve, the current time, and the amount of time system is in running state, number of users currently logged into, and the load time for the past 1, 5 and 15 minutes respectively.

How do I check uptime on multiple Linux servers?

First, open the terminal window and then type: uptime command – Tell how long the Linux system has been running. w command – Show who is logged on and what they are doing including the uptime of a Linux box. top command – Display Linux server processes and display system Uptime in Linux too.


3 Answers

alias uptime='echo " 11:07:17 up 10 BILLION YEARS!,  4 users,  load average: 0.38, 0.52, 0.41"'

If you want to get extra-fancy, you could take the actual uptime output and modify that.

like image 200
Joachim Sauer Avatar answered Sep 30 '22 03:09

Joachim Sauer


Have a look at this utility: UptimeFaker.

like image 34
msx Avatar answered Sep 30 '22 04:09

msx


Yeah, you should be able to attach a gdb to the running kernel, and hack the uptime value. You'd need to know where it was kept, and have a symbols file. I am assuming here, that uptime is held in something statically allocated.

Alternatively, write a small kernel module which hacks the uptime when you load it (and immediately unloads again).

like image 36
MarkR Avatar answered Sep 30 '22 04:09

MarkR