Log Files - difference between using sudo or not
You start by going into the logs with cd /var/log
Then you want to look at the kern.log
I did this firstly by using sudo less kern.log, then less kern.log
Both outputs were the same.
So what exactly is the difference between using sudo for the command, or leaving it without it?
command-line log
add a comment |
You start by going into the logs with cd /var/log
Then you want to look at the kern.log
I did this firstly by using sudo less kern.log, then less kern.log
Both outputs were the same.
So what exactly is the difference between using sudo for the command, or leaving it without it?
command-line log
add a comment |
You start by going into the logs with cd /var/log
Then you want to look at the kern.log
I did this firstly by using sudo less kern.log, then less kern.log
Both outputs were the same.
So what exactly is the difference between using sudo for the command, or leaving it without it?
command-line log
You start by going into the logs with cd /var/log
Then you want to look at the kern.log
I did this firstly by using sudo less kern.log, then less kern.log
Both outputs were the same.
So what exactly is the difference between using sudo for the command, or leaving it without it?
command-line log
command-line log
asked Jan 3 at 13:07
Felix RFelix R
113
113
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
The sudo
lets you access whether it be to read (as in your case) or to write to folders and files irrespective of the ownership status or permission status of those folders or files.
In this case of the /var/log
folder these files usually don't need you to be the root user
to read from them hence log files are accessible for most users at least the read part. But we have certain processes that will produce log entries that only the system user
(that created those log) or the root user
can read from such files, examples include auth.log
, mail.log
, php7.2-fpm.log
etc. These I have picked from my own /var/log
folder.
Run the command ls -l /var/log
to see those files and the permissions that are associated with them, including their ownerships. From there you can decern when you will need to use sudo
and when you will not.
add a comment |
For succesful use of the less
-command you will need read-permissions. Let's check the permissions of the file:
~$ ll /var/log/kern.log
-rw-r----- 1 syslog adm 1366232 Jan 3 19:50 /var/log/kern.log
The file is owned by the user syslog
who has read and write permissions. The file is also associated with the group adm
which has read permission. As you were able to read the file as a regular (non-root) user, you are obviously a member of the adm
-group. You may check it with the groups
-command.
~$ groups
mook adm cdrom sudo audio dip plugdev lpadmin sambashare
add a comment |
sudo
command allows you run commands with security privileges of another user, by default as the superuser
or root user
. you can not run the init
command as normal user until you use sudo
, like that there are lots of other administrative commands and operation where you must use sudo
to perform those operations, there are lot of security reason why we are using sudo
.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2faskubuntu.com%2fquestions%2f1106574%2flog-files-difference-between-using-sudo-or-not%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
The sudo
lets you access whether it be to read (as in your case) or to write to folders and files irrespective of the ownership status or permission status of those folders or files.
In this case of the /var/log
folder these files usually don't need you to be the root user
to read from them hence log files are accessible for most users at least the read part. But we have certain processes that will produce log entries that only the system user
(that created those log) or the root user
can read from such files, examples include auth.log
, mail.log
, php7.2-fpm.log
etc. These I have picked from my own /var/log
folder.
Run the command ls -l /var/log
to see those files and the permissions that are associated with them, including their ownerships. From there you can decern when you will need to use sudo
and when you will not.
add a comment |
The sudo
lets you access whether it be to read (as in your case) or to write to folders and files irrespective of the ownership status or permission status of those folders or files.
In this case of the /var/log
folder these files usually don't need you to be the root user
to read from them hence log files are accessible for most users at least the read part. But we have certain processes that will produce log entries that only the system user
(that created those log) or the root user
can read from such files, examples include auth.log
, mail.log
, php7.2-fpm.log
etc. These I have picked from my own /var/log
folder.
Run the command ls -l /var/log
to see those files and the permissions that are associated with them, including their ownerships. From there you can decern when you will need to use sudo
and when you will not.
add a comment |
The sudo
lets you access whether it be to read (as in your case) or to write to folders and files irrespective of the ownership status or permission status of those folders or files.
In this case of the /var/log
folder these files usually don't need you to be the root user
to read from them hence log files are accessible for most users at least the read part. But we have certain processes that will produce log entries that only the system user
(that created those log) or the root user
can read from such files, examples include auth.log
, mail.log
, php7.2-fpm.log
etc. These I have picked from my own /var/log
folder.
Run the command ls -l /var/log
to see those files and the permissions that are associated with them, including their ownerships. From there you can decern when you will need to use sudo
and when you will not.
The sudo
lets you access whether it be to read (as in your case) or to write to folders and files irrespective of the ownership status or permission status of those folders or files.
In this case of the /var/log
folder these files usually don't need you to be the root user
to read from them hence log files are accessible for most users at least the read part. But we have certain processes that will produce log entries that only the system user
(that created those log) or the root user
can read from such files, examples include auth.log
, mail.log
, php7.2-fpm.log
etc. These I have picked from my own /var/log
folder.
Run the command ls -l /var/log
to see those files and the permissions that are associated with them, including their ownerships. From there you can decern when you will need to use sudo
and when you will not.
edited Jan 3 at 13:40
answered Jan 3 at 13:16
George UdosenGeorge Udosen
20.6k94467
20.6k94467
add a comment |
add a comment |
For succesful use of the less
-command you will need read-permissions. Let's check the permissions of the file:
~$ ll /var/log/kern.log
-rw-r----- 1 syslog adm 1366232 Jan 3 19:50 /var/log/kern.log
The file is owned by the user syslog
who has read and write permissions. The file is also associated with the group adm
which has read permission. As you were able to read the file as a regular (non-root) user, you are obviously a member of the adm
-group. You may check it with the groups
-command.
~$ groups
mook adm cdrom sudo audio dip plugdev lpadmin sambashare
add a comment |
For succesful use of the less
-command you will need read-permissions. Let's check the permissions of the file:
~$ ll /var/log/kern.log
-rw-r----- 1 syslog adm 1366232 Jan 3 19:50 /var/log/kern.log
The file is owned by the user syslog
who has read and write permissions. The file is also associated with the group adm
which has read permission. As you were able to read the file as a regular (non-root) user, you are obviously a member of the adm
-group. You may check it with the groups
-command.
~$ groups
mook adm cdrom sudo audio dip plugdev lpadmin sambashare
add a comment |
For succesful use of the less
-command you will need read-permissions. Let's check the permissions of the file:
~$ ll /var/log/kern.log
-rw-r----- 1 syslog adm 1366232 Jan 3 19:50 /var/log/kern.log
The file is owned by the user syslog
who has read and write permissions. The file is also associated with the group adm
which has read permission. As you were able to read the file as a regular (non-root) user, you are obviously a member of the adm
-group. You may check it with the groups
-command.
~$ groups
mook adm cdrom sudo audio dip plugdev lpadmin sambashare
For succesful use of the less
-command you will need read-permissions. Let's check the permissions of the file:
~$ ll /var/log/kern.log
-rw-r----- 1 syslog adm 1366232 Jan 3 19:50 /var/log/kern.log
The file is owned by the user syslog
who has read and write permissions. The file is also associated with the group adm
which has read permission. As you were able to read the file as a regular (non-root) user, you are obviously a member of the adm
-group. You may check it with the groups
-command.
~$ groups
mook adm cdrom sudo audio dip plugdev lpadmin sambashare
answered Jan 3 at 13:27
mook765mook765
3,96421330
3,96421330
add a comment |
add a comment |
sudo
command allows you run commands with security privileges of another user, by default as the superuser
or root user
. you can not run the init
command as normal user until you use sudo
, like that there are lots of other administrative commands and operation where you must use sudo
to perform those operations, there are lot of security reason why we are using sudo
.
add a comment |
sudo
command allows you run commands with security privileges of another user, by default as the superuser
or root user
. you can not run the init
command as normal user until you use sudo
, like that there are lots of other administrative commands and operation where you must use sudo
to perform those operations, there are lot of security reason why we are using sudo
.
add a comment |
sudo
command allows you run commands with security privileges of another user, by default as the superuser
or root user
. you can not run the init
command as normal user until you use sudo
, like that there are lots of other administrative commands and operation where you must use sudo
to perform those operations, there are lot of security reason why we are using sudo
.
sudo
command allows you run commands with security privileges of another user, by default as the superuser
or root user
. you can not run the init
command as normal user until you use sudo
, like that there are lots of other administrative commands and operation where you must use sudo
to perform those operations, there are lot of security reason why we are using sudo
.
answered Jan 3 at 13:33
souravsourav
791313
791313
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- 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%2faskubuntu.com%2fquestions%2f1106574%2flog-files-difference-between-using-sudo-or-not%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