LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 04-20-2006, 05:20 PM   #1
Micro420
Senior Member
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Rep: Reputation: 45
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
 
Old 04-20-2006, 05:25 PM   #2
BobNutfield
Senior Member
 
Registered: Dec 2005
Location: United Kingdom
Distribution: Fedora , Ubuntu, Slackware-Current
Posts: 1,477

Rep: Reputation: 51
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
 
Old 04-20-2006, 05:27 PM   #3
ataraxia
Member
 
Registered: Apr 2006
Location: Pittsburgh
Distribution: Debian Sid AMD64
Posts: 296

Rep: Reputation: 30
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 .
 
Old 04-20-2006, 08:04 PM   #4
Micro420
Senior Member
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Original Poster
Rep: Reputation: 45
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?
 
Old 04-20-2006, 08:16 PM   #5
ataraxia
Member
 
Registered: Apr 2006
Location: Pittsburgh
Distribution: Debian Sid AMD64
Posts: 296

Rep: Reputation: 30
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
 
Old 04-21-2006, 12:58 AM   #6
Micro420
Senior Member
 
Registered: Aug 2003
Location: Berkeley, CA
Distribution: Mac OS X Leopard 10.6.2, Windows 2003 Server/Vista/7/XP/2000/NT/98, Ubuntux64, CentOS4.8/5.4
Posts: 2,986

Original Poster
Rep: Reputation: 45
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?

Last edited by Micro420; 04-21-2006 at 01:07 AM.
 
Old 04-21-2006, 08:39 PM   #7
ataraxia
Member
 
Registered: Apr 2006
Location: Pittsburgh
Distribution: Debian Sid AMD64
Posts: 296

Rep: Reputation: 30
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?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SDLQuake2 and /var/log/messages questions noxious Slackware 2 05-26-2005 07:31 PM
Redirecting the kernel messages to file other than /var/log/messages jyotika_b83 Linux - General 3 04-28-2005 06:39 PM
Deleted /var/log/messages, can't log any files-iptables chingyenccy Linux - Newbie 7 02-27-2005 04:03 PM
/var/log/messages full of these messages. Should I be concerned? mdavis Linux - Security 5 04-16-2004 10:08 AM
iptables, changing log file from /var/log/messages acid2000 Linux - Networking 3 03-11-2003 08:38 PM


All times are GMT -5. The time now is 02:54 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration