LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 08-12-2005, 11:56 AM   #1
AQG
Member
 
Registered: Jun 2005
Distribution: SuSE, Red Hat
Posts: 162

Rep: Reputation: 30
!!!! Urgent, using chown command ?


Hi, i've made a big mistake how can i revert the process. it needs to be like list one instead o f list 2


list1:

total 108
drwxr-xr-x 2 root root 4096 Apr 30 2004 ITsoftware/
drwx--x--x 3 adrian root 4096 Aug 12 09:26 adrian/
-rw-r--r-- 1 root root 6144 Aug 11 18:23 aquota.group
-rw-r--r-- 1 root root 8192 Aug 11 18:23 aquota.user
drwx------ 20 carlos users 4096 Apr 30 16:07 carlos/
drwx--x--x 25 carlosm users 4096 Jul 6 17:40 carlosm/
drwx--x--x 2 dtcruz users 4096 Mar 17 2004 dtcruz/
drwxr-s--T 5 egresado egregr 4096 Jun 5 23:15 egresados/
drwxr-xr-x 2 root root 4096 Sep 23 2003 ftp/
drwxr-xr-x 5 root root 4096 Feb 10 2004 home/
drwxrwxr-x 44 nobody users 4096 Jul 1 12:15 httpd/
-rw------- 1 nobody nobody 5177 Jan 29 2003 httpd.directory
drwxrwxr-x 70 nobody nobody 8192 Oct 8 2004 httpdOLD/
drwxr-xr-x 4 nobody egregr 4096 Apr 4 2000 itmweb/
drwx--x--x 3 jsp users 4096 May 6 2004 jsp/
drwx------ 2 root root 16384 Feb 10 2004 lost+found/
drwx------ 14 malvido users 4096 Oct 10 2003 malvido/
drwx--x--x 2 mario root 4096 Jun 20 18:32 mario/
-rw-r--r-- 1 root root 0 May 30 15:42 prueba
drwxr-xr-x 2 egresado users 4096 May 30 14:36 quintero/
drwx--x--x 12 1001 users 4096 Apr 27 2004 rael/
root@www:/home# chown adrian:users
chown: too few arguments
Try `chown --help' for more information.
root@www:/home# chown adrian:users *
root@www:/home# LS -L
-bash: LS: command not found
root@www:/home# ls -l
total 108



list2:

drwxr-xr-x 2 adrian users 4096 Apr 30 2004 ITsoftware/
drwx--x--x 3 adrian users 4096 Aug 12 09:26 adrian/
-rw-r--r-- 1 adrian users 6144 Aug 11 18:23 aquota.group
-rw-r--r-- 1 adrian users 8192 Aug 11 18:23 aquota.user
drwx------ 20 adrian users 4096 Apr 30 16:07 carlos/
drwx--x--x 25 adrian users 4096 Jul 6 17:40 carlosm/
drwx--x--x 2 adrian users 4096 Mar 17 2004 dtcruz/
drwxr-s--T 5 adrian users 4096 Jun 5 23:15 egresados/
drwxr-xr-x 2 adrian users 4096 Sep 23 2003 ftp/
drwxr-xr-x 5 adrian users 4096 Feb 10 2004 home/
drwxrwxr-x 44 adrian users 4096 Jul 1 12:15 httpd/
-rw------- 1 adrian users 5177 Jan 29 2003 httpd.directory
drwxrwxr-x 70 adrian users 8192 Oct 8 2004 httpdOLD/
drwxr-xr-x 4 adrian users 4096 Apr 4 2000 itmweb/
drwx--x--x 3 adrian users 4096 May 6 2004 jsp/
drwx------ 2 adrian users 16384 Feb 10 2004 lost+found/
drwx------ 14 adrian users 4096 Oct 10 2003 malvido/
drwx--x--x 2 adrian users 4096 Jun 20 18:32 mario/
-rw-r--r-- 1 adrian users 0 May 30 15:42 prueba
drwxr-xr-x 2 adrian users 4096 May 30 14:36 quintero/
drwx--x--x 12 adrian users 4096 Apr 27 2004 rael/
 
Old 08-12-2005, 12:07 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 125Reputation: 125
At least you didn't chown -R it

Code:
# cd /home ; for i in * ; do [ -d "$i" ] && chown $i:users $i ; done
# chown root:root aquota.*
 
Old 08-12-2005, 12:12 PM   #3
AQG
Member
 
Registered: Jun 2005
Distribution: SuSE, Red Hat
Posts: 162

Original Poster
Rep: Reputation: 30
I'm a little dum for this can you be a little more descriptive

thanks.
 
Old 08-12-2005, 12:14 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 125Reputation: 125
Actually... my command missed a few things, a few oddities in /home where the dirname was not the same as the owner.

Why don't you just chown them properly? There aren't that many to be changed.
 
Old 08-12-2005, 12:15 PM   #5
AQG
Member
 
Registered: Jun 2005
Distribution: SuSE, Red Hat
Posts: 162

Original Poster
Rep: Reputation: 30
ok, can you please send me an example of how to chown one.
 
Old 08-12-2005, 12:18 PM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 125Reputation: 125
Code:
chown USERNAME:GROUP DIRECTORY
And read the chown man page.
 
Old 08-12-2005, 12:32 PM   #7
AQG
Member
 
Registered: Jun 2005
Distribution: SuSE, Red Hat
Posts: 162

Original Poster
Rep: Reputation: 30
Thank you very much Matir,
i've got it .
may be later if you have time you can explain how the following works

# cd /home ; for i in * ; do [ -d "$i" ] && chown $i:users $i ; done
# chown root:root aquota.*
 
Old 08-12-2005, 12:58 PM   #8
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 125Reputation: 125
That little one-liner was supposed to set the owner of each directory to the name of the directory, based on the assumption that owner(/home/DIR)==DIR, which is generally true for user home dirs.

It just looped through the dirs and performed chown.
 
Old 08-12-2005, 03:21 PM   #9
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Don't use "urgent" in thread titles, it's not gonna make people reply any quicker .
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Chown command giving invalid user ServerStorm Linux - Software 6 03-23-2010 02:42 AM
permissions messed up chown command used tsayles21 Debian 3 03-30-2004 08:38 PM
I Have a problem with the CHOWN command AnnePeter Linux - Software 5 03-12-2004 07:37 AM
So... I used Chown command and screwed my pc... Nosram Linux - Newbie 3 01-20-2004 06:09 AM
chown command help ksgill Linux - Newbie 9 04-28-2003 10:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

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

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration