What command always generates the same UUID through /proc/sys/kernel
Running the following command generates different random output on each execution (which is expected, considering that random is in the path):
cat /proc/sys/kernel/random/uuid
Is there any way to modify the path so that it results in a static (not random) UUID on each call (return the same thing on each request/execution instead of being random)?
proc uuid
add a comment |
Running the following command generates different random output on each execution (which is expected, considering that random is in the path):
cat /proc/sys/kernel/random/uuid
Is there any way to modify the path so that it results in a static (not random) UUID on each call (return the same thing on each request/execution instead of being random)?
proc uuid
4
This doesn't make sense much. Auuid (Universal Unique IDentifier)is meant to be unique among system's generated uuid's as well as global known uuid's. If you want to refer to the same uuid you generate, just usemystaticuuid=$(uuidgen)and then call it usingecho "$mystaticuuid"
– Valentin Bajrami
Mar 8 '17 at 9:48
add a comment |
Running the following command generates different random output on each execution (which is expected, considering that random is in the path):
cat /proc/sys/kernel/random/uuid
Is there any way to modify the path so that it results in a static (not random) UUID on each call (return the same thing on each request/execution instead of being random)?
proc uuid
Running the following command generates different random output on each execution (which is expected, considering that random is in the path):
cat /proc/sys/kernel/random/uuid
Is there any way to modify the path so that it results in a static (not random) UUID on each call (return the same thing on each request/execution instead of being random)?
proc uuid
proc uuid
edited Mar 8 '17 at 9:41
schaiba
5,53912229
5,53912229
asked Mar 8 '17 at 9:39
Agi HammerthiefAgi Hammerthief
379120
379120
4
This doesn't make sense much. Auuid (Universal Unique IDentifier)is meant to be unique among system's generated uuid's as well as global known uuid's. If you want to refer to the same uuid you generate, just usemystaticuuid=$(uuidgen)and then call it usingecho "$mystaticuuid"
– Valentin Bajrami
Mar 8 '17 at 9:48
add a comment |
4
This doesn't make sense much. Auuid (Universal Unique IDentifier)is meant to be unique among system's generated uuid's as well as global known uuid's. If you want to refer to the same uuid you generate, just usemystaticuuid=$(uuidgen)and then call it usingecho "$mystaticuuid"
– Valentin Bajrami
Mar 8 '17 at 9:48
4
4
This doesn't make sense much. A
uuid (Universal Unique IDentifier) is meant to be unique among system's generated uuid's as well as global known uuid's. If you want to refer to the same uuid you generate, just use mystaticuuid=$(uuidgen) and then call it using echo "$mystaticuuid"– Valentin Bajrami
Mar 8 '17 at 9:48
This doesn't make sense much. A
uuid (Universal Unique IDentifier) is meant to be unique among system's generated uuid's as well as global known uuid's. If you want to refer to the same uuid you generate, just use mystaticuuid=$(uuidgen) and then call it using echo "$mystaticuuid"– Valentin Bajrami
Mar 8 '17 at 9:48
add a comment |
2 Answers
2
active
oldest
votes
You asked
Is there any way to modify the path so that it results in a static (not random) UUID on each call
And the answer to this is "yes, definitely".
If you prepare the environment like this:
cat /proc/sys/kernel/random/uuid >/tmp/uuid
You can modify the path to get a static UUID on each call, like this
cat /tmp/uuid
Well, that's obvious, I suppose. (I blame lack of sleep for not thinking that through.)
– Agi Hammerthief
Mar 8 '17 at 10:49
1
@Agi what are you actually trying to achieve?
– roaima
Mar 8 '17 at 11:16
What I actually want to do is create a unique ID for a machine running GNU/Linux, thinking that running a slight adaptation of/proc/sys/kernel/random/uuidwould be the way to go. On Windows, I can runwmic DISKDRIVE get SerialNumberand query the registry for the value ofHKLMSoftwareMicrosoftCryptographyMachineGuidto get values I can work with. I was wondering if I could achieve something similar with GNU/Linux (other than getting the HWAddrs of all NICs in the machine and hashing them, as I have seen suggested). However, I'll ask a separate question for that.
– Agi Hammerthief
Mar 8 '17 at 12:39
I have some existing Java software that uses a Windows-specific DLL to retrieve hardware information and generate a hashed UID for the machine on which it runs (implementation details of which are known to me). I'm trying to port it to GNU/Linux and the licensing is what prevents me from porting it. (The output doesn't have to be the same on both platforms, but it would be advantageous if it is.)
– Agi Hammerthief
Mar 8 '17 at 12:49
2
@AgiHammerthief take a look at generate consistent machine unique ID
– roaima
Mar 8 '17 at 13:42
add a comment |
Having recently needed to build some licensing functionality into an application (the problem I was trying to solve when first posting this question), I found that it's possible to obtain a static UUID from one of the following files:
/etc/machine-id # preferred
/var/lib/dbus/machine-id # Usually a symlink to /etc/machine-id
/var/db/dbus/machine-id # usually a symlink/alternative to /var/lib/dbus/machine-id
/proc/sys/kernel/random/uuid # Will vary on each invocation, so save output to another file
# (as per roaima's answer).
In the above list of files, they're listed from most preferred to least preferred.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f349952%2fwhat-command-always-generates-the-same-uuid-through-proc-sys-kernel%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You asked
Is there any way to modify the path so that it results in a static (not random) UUID on each call
And the answer to this is "yes, definitely".
If you prepare the environment like this:
cat /proc/sys/kernel/random/uuid >/tmp/uuid
You can modify the path to get a static UUID on each call, like this
cat /tmp/uuid
Well, that's obvious, I suppose. (I blame lack of sleep for not thinking that through.)
– Agi Hammerthief
Mar 8 '17 at 10:49
1
@Agi what are you actually trying to achieve?
– roaima
Mar 8 '17 at 11:16
What I actually want to do is create a unique ID for a machine running GNU/Linux, thinking that running a slight adaptation of/proc/sys/kernel/random/uuidwould be the way to go. On Windows, I can runwmic DISKDRIVE get SerialNumberand query the registry for the value ofHKLMSoftwareMicrosoftCryptographyMachineGuidto get values I can work with. I was wondering if I could achieve something similar with GNU/Linux (other than getting the HWAddrs of all NICs in the machine and hashing them, as I have seen suggested). However, I'll ask a separate question for that.
– Agi Hammerthief
Mar 8 '17 at 12:39
I have some existing Java software that uses a Windows-specific DLL to retrieve hardware information and generate a hashed UID for the machine on which it runs (implementation details of which are known to me). I'm trying to port it to GNU/Linux and the licensing is what prevents me from porting it. (The output doesn't have to be the same on both platforms, but it would be advantageous if it is.)
– Agi Hammerthief
Mar 8 '17 at 12:49
2
@AgiHammerthief take a look at generate consistent machine unique ID
– roaima
Mar 8 '17 at 13:42
add a comment |
You asked
Is there any way to modify the path so that it results in a static (not random) UUID on each call
And the answer to this is "yes, definitely".
If you prepare the environment like this:
cat /proc/sys/kernel/random/uuid >/tmp/uuid
You can modify the path to get a static UUID on each call, like this
cat /tmp/uuid
Well, that's obvious, I suppose. (I blame lack of sleep for not thinking that through.)
– Agi Hammerthief
Mar 8 '17 at 10:49
1
@Agi what are you actually trying to achieve?
– roaima
Mar 8 '17 at 11:16
What I actually want to do is create a unique ID for a machine running GNU/Linux, thinking that running a slight adaptation of/proc/sys/kernel/random/uuidwould be the way to go. On Windows, I can runwmic DISKDRIVE get SerialNumberand query the registry for the value ofHKLMSoftwareMicrosoftCryptographyMachineGuidto get values I can work with. I was wondering if I could achieve something similar with GNU/Linux (other than getting the HWAddrs of all NICs in the machine and hashing them, as I have seen suggested). However, I'll ask a separate question for that.
– Agi Hammerthief
Mar 8 '17 at 12:39
I have some existing Java software that uses a Windows-specific DLL to retrieve hardware information and generate a hashed UID for the machine on which it runs (implementation details of which are known to me). I'm trying to port it to GNU/Linux and the licensing is what prevents me from porting it. (The output doesn't have to be the same on both platforms, but it would be advantageous if it is.)
– Agi Hammerthief
Mar 8 '17 at 12:49
2
@AgiHammerthief take a look at generate consistent machine unique ID
– roaima
Mar 8 '17 at 13:42
add a comment |
You asked
Is there any way to modify the path so that it results in a static (not random) UUID on each call
And the answer to this is "yes, definitely".
If you prepare the environment like this:
cat /proc/sys/kernel/random/uuid >/tmp/uuid
You can modify the path to get a static UUID on each call, like this
cat /tmp/uuid
You asked
Is there any way to modify the path so that it results in a static (not random) UUID on each call
And the answer to this is "yes, definitely".
If you prepare the environment like this:
cat /proc/sys/kernel/random/uuid >/tmp/uuid
You can modify the path to get a static UUID on each call, like this
cat /tmp/uuid
answered Mar 8 '17 at 9:43
roaimaroaima
44.7k655121
44.7k655121
Well, that's obvious, I suppose. (I blame lack of sleep for not thinking that through.)
– Agi Hammerthief
Mar 8 '17 at 10:49
1
@Agi what are you actually trying to achieve?
– roaima
Mar 8 '17 at 11:16
What I actually want to do is create a unique ID for a machine running GNU/Linux, thinking that running a slight adaptation of/proc/sys/kernel/random/uuidwould be the way to go. On Windows, I can runwmic DISKDRIVE get SerialNumberand query the registry for the value ofHKLMSoftwareMicrosoftCryptographyMachineGuidto get values I can work with. I was wondering if I could achieve something similar with GNU/Linux (other than getting the HWAddrs of all NICs in the machine and hashing them, as I have seen suggested). However, I'll ask a separate question for that.
– Agi Hammerthief
Mar 8 '17 at 12:39
I have some existing Java software that uses a Windows-specific DLL to retrieve hardware information and generate a hashed UID for the machine on which it runs (implementation details of which are known to me). I'm trying to port it to GNU/Linux and the licensing is what prevents me from porting it. (The output doesn't have to be the same on both platforms, but it would be advantageous if it is.)
– Agi Hammerthief
Mar 8 '17 at 12:49
2
@AgiHammerthief take a look at generate consistent machine unique ID
– roaima
Mar 8 '17 at 13:42
add a comment |
Well, that's obvious, I suppose. (I blame lack of sleep for not thinking that through.)
– Agi Hammerthief
Mar 8 '17 at 10:49
1
@Agi what are you actually trying to achieve?
– roaima
Mar 8 '17 at 11:16
What I actually want to do is create a unique ID for a machine running GNU/Linux, thinking that running a slight adaptation of/proc/sys/kernel/random/uuidwould be the way to go. On Windows, I can runwmic DISKDRIVE get SerialNumberand query the registry for the value ofHKLMSoftwareMicrosoftCryptographyMachineGuidto get values I can work with. I was wondering if I could achieve something similar with GNU/Linux (other than getting the HWAddrs of all NICs in the machine and hashing them, as I have seen suggested). However, I'll ask a separate question for that.
– Agi Hammerthief
Mar 8 '17 at 12:39
I have some existing Java software that uses a Windows-specific DLL to retrieve hardware information and generate a hashed UID for the machine on which it runs (implementation details of which are known to me). I'm trying to port it to GNU/Linux and the licensing is what prevents me from porting it. (The output doesn't have to be the same on both platforms, but it would be advantageous if it is.)
– Agi Hammerthief
Mar 8 '17 at 12:49
2
@AgiHammerthief take a look at generate consistent machine unique ID
– roaima
Mar 8 '17 at 13:42
Well, that's obvious, I suppose. (I blame lack of sleep for not thinking that through.)
– Agi Hammerthief
Mar 8 '17 at 10:49
Well, that's obvious, I suppose. (I blame lack of sleep for not thinking that through.)
– Agi Hammerthief
Mar 8 '17 at 10:49
1
1
@Agi what are you actually trying to achieve?
– roaima
Mar 8 '17 at 11:16
@Agi what are you actually trying to achieve?
– roaima
Mar 8 '17 at 11:16
What I actually want to do is create a unique ID for a machine running GNU/Linux, thinking that running a slight adaptation of
/proc/sys/kernel/random/uuid would be the way to go. On Windows, I can run wmic DISKDRIVE get SerialNumber and query the registry for the value of HKLMSoftwareMicrosoftCryptographyMachineGuid to get values I can work with. I was wondering if I could achieve something similar with GNU/Linux (other than getting the HWAddrs of all NICs in the machine and hashing them, as I have seen suggested). However, I'll ask a separate question for that.– Agi Hammerthief
Mar 8 '17 at 12:39
What I actually want to do is create a unique ID for a machine running GNU/Linux, thinking that running a slight adaptation of
/proc/sys/kernel/random/uuid would be the way to go. On Windows, I can run wmic DISKDRIVE get SerialNumber and query the registry for the value of HKLMSoftwareMicrosoftCryptographyMachineGuid to get values I can work with. I was wondering if I could achieve something similar with GNU/Linux (other than getting the HWAddrs of all NICs in the machine and hashing them, as I have seen suggested). However, I'll ask a separate question for that.– Agi Hammerthief
Mar 8 '17 at 12:39
I have some existing Java software that uses a Windows-specific DLL to retrieve hardware information and generate a hashed UID for the machine on which it runs (implementation details of which are known to me). I'm trying to port it to GNU/Linux and the licensing is what prevents me from porting it. (The output doesn't have to be the same on both platforms, but it would be advantageous if it is.)
– Agi Hammerthief
Mar 8 '17 at 12:49
I have some existing Java software that uses a Windows-specific DLL to retrieve hardware information and generate a hashed UID for the machine on which it runs (implementation details of which are known to me). I'm trying to port it to GNU/Linux and the licensing is what prevents me from porting it. (The output doesn't have to be the same on both platforms, but it would be advantageous if it is.)
– Agi Hammerthief
Mar 8 '17 at 12:49
2
2
@AgiHammerthief take a look at generate consistent machine unique ID
– roaima
Mar 8 '17 at 13:42
@AgiHammerthief take a look at generate consistent machine unique ID
– roaima
Mar 8 '17 at 13:42
add a comment |
Having recently needed to build some licensing functionality into an application (the problem I was trying to solve when first posting this question), I found that it's possible to obtain a static UUID from one of the following files:
/etc/machine-id # preferred
/var/lib/dbus/machine-id # Usually a symlink to /etc/machine-id
/var/db/dbus/machine-id # usually a symlink/alternative to /var/lib/dbus/machine-id
/proc/sys/kernel/random/uuid # Will vary on each invocation, so save output to another file
# (as per roaima's answer).
In the above list of files, they're listed from most preferred to least preferred.
add a comment |
Having recently needed to build some licensing functionality into an application (the problem I was trying to solve when first posting this question), I found that it's possible to obtain a static UUID from one of the following files:
/etc/machine-id # preferred
/var/lib/dbus/machine-id # Usually a symlink to /etc/machine-id
/var/db/dbus/machine-id # usually a symlink/alternative to /var/lib/dbus/machine-id
/proc/sys/kernel/random/uuid # Will vary on each invocation, so save output to another file
# (as per roaima's answer).
In the above list of files, they're listed from most preferred to least preferred.
add a comment |
Having recently needed to build some licensing functionality into an application (the problem I was trying to solve when first posting this question), I found that it's possible to obtain a static UUID from one of the following files:
/etc/machine-id # preferred
/var/lib/dbus/machine-id # Usually a symlink to /etc/machine-id
/var/db/dbus/machine-id # usually a symlink/alternative to /var/lib/dbus/machine-id
/proc/sys/kernel/random/uuid # Will vary on each invocation, so save output to another file
# (as per roaima's answer).
In the above list of files, they're listed from most preferred to least preferred.
Having recently needed to build some licensing functionality into an application (the problem I was trying to solve when first posting this question), I found that it's possible to obtain a static UUID from one of the following files:
/etc/machine-id # preferred
/var/lib/dbus/machine-id # Usually a symlink to /etc/machine-id
/var/db/dbus/machine-id # usually a symlink/alternative to /var/lib/dbus/machine-id
/proc/sys/kernel/random/uuid # Will vary on each invocation, so save output to another file
# (as per roaima's answer).
In the above list of files, they're listed from most preferred to least preferred.
answered Feb 4 at 14:33
Agi HammerthiefAgi Hammerthief
379120
379120
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f349952%2fwhat-command-always-generates-the-same-uuid-through-proc-sys-kernel%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
4
This doesn't make sense much. A
uuid (Universal Unique IDentifier)is meant to be unique among system's generated uuid's as well as global known uuid's. If you want to refer to the same uuid you generate, just usemystaticuuid=$(uuidgen)and then call it usingecho "$mystaticuuid"– Valentin Bajrami
Mar 8 '17 at 9:48