LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Changing ownership of directories; /var/log/messages questions (http://www.linuxquestions.org/questions/linux-general-1/changing-ownership-of-directories%3B-var-log-messages-questions-437242/)

Micro420 04-20-2006 06:20 PM

Changing ownership of directories; /var/log/messages questions
 
Simple questions as I am learning command line:

1) How does a user take ownership of a directory in the command line?
example:

Code:

drwxr-xr-x  3 root root 152 2006-03-12 22:52 mp3
Do I use the command chown?

2) how do I clear my /var/log/messages? Just delete it?

2a) How do I tell the system what I do and do not want logged in the /var/log/messages? At the moment it's logging in silly stuff like the websites I view. The Linux I am using is currently set as a DNS server, too!

Thank you

BobNutfield 04-20-2006 06:25 PM

A directory or file already has ownership when it is created, owned by the creater. The chown command is used to change the ownership of the file or directory and can only be performed by the owner of the file or by root.


Simple example:

# chowm bob myfile (sets the ownership of myfile to bob)

Hope this helps

Bob

ataraxia 04-20-2006 06:27 PM

Quote:

Originally Posted by Micro420
Simple questions as I am learning command line:

1) How does a user take ownership of a directory in the command line?
example:

Code:

drwxr-xr-x  3 root root 152 2006-03-12 22:52 mp3
Do I use the command chown?

Right. If you wanted to give this "mp3" directory to a user called "user2", you would type
Code:

chown user2 mp3
If you also wanted to give that user all of the files and directories that are inside of "mp3", you would do
Code:

chown -R user2 mp3
Quote:

Originally Posted by Micro420
2) how do I clear my /var/log/messages? Just delete it?

You can delete the individual files from it, but then you need to create new, empty ones, and to restart syslogd. I'd suggest you don't bother - these files will get rotated and old entries will "expire".

Quote:

Originally Posted by Micro420
2a) How do I tell the system what I do and do not want logged in the /var/log/messages? At the moment it's logging in silly stuff like the websites I view. The Linux I am using is currently set as a DNS server, too!

Edit /etc/syslog.conf .

Micro420 04-20-2006 09:04 PM

Thanks! the chown command worked!

I found the configurations for my /var/logs. In SuSE 10 they are located in /etc/syslog-ng/syslog-ng.conf.in. I used 'vi' to look through it and it looks complex so I won't touch it. I'll try to find some online resources about this.

My next quick question is the 'sudo' usage. How do I give certain users privileges to use the sudo command?

ataraxia 04-20-2006 09:16 PM

Quote:

Originally Posted by Micro420
I found the configurations for my /var/logs. In SuSE 10 they are located in /etc/syslog-ng/syslog-ng.conf.in. I used 'vi' to look through it and it looks complex so I won't touch it. I'll try to find some online resources about this.

Ah, SuSE uses Syslog-NG. I don't know it.

Quote:

Originally Posted by Micro420
My next quick question is the 'sudo' usage. How do I give certain users privileges to use the sudo command?

As root, run the "visudo" command. This will let you edit the sudo config file. It's very flexible - the "sudoers" man page documents the possibilites in excruciating detail. I just use simple ones like this:
Code:

ataraxia  ALL=(ALL) ALL

Micro420 04-21-2006 01:58 AM

Thanks for the visudo command. I added myself in and can run the 'sudo' command,

Code:

#User privilege specification
root ALL=(ALL) ALL
micro420 ALL=(ALL) ALL

I then run a sudo command:
Code:

sudo cat /etc/shadow
However, I am still asked for the password (root password). Inputting my user password does not work, but putting in the root password works.

I then tried
Code:

sudo -u micro420 cat /etc/shadow
I then get the error:
cat: shadow: Permission Denied

How do I get the user password to work with sudo?

ataraxia 04-21-2006 09:39 PM

That's really weird. I've never had sudo ask me for the root password. You weren't doing something silly like running your "sudo cat /etc/shadow" when you were already root or something, were you?


All times are GMT -5. The time now is 05:05 PM.