Question about ls -l


 
Thread Tools Search this Thread
Operating Systems Solaris Question about ls -l
# 1  
Old 02-22-2013
Question about ls -l

Good afternoon, I hope that someone can make a suggestion or two as what my issues are and how to solve them, or suggest the correct group to post the questions to.

I have successfully installed Oracle Solaris 11.1 (x86/64-bit) installation on Oracle VirtualBox. Now, I would like to install Oracle 11gR2 in my Oracle Solaris 11.1 environment. At the moment, I am completing the pre-installation instructions. Having signed on as the root user, I created the oracle user and the oinstall group. Further on, the instructions call for the creation of two directories, /u01/app/oracle and /u02/oradata, which I created without error, both directories being owned by root. Next, the instructions call for changing the owner and group to the oracle user and the oinstall group, as follows:

Code:
# chown -R oracle:oinstall /u01/app/oracle
# chown -R oracle:oinstall /u02/oradata

My specific issue is that after performing the chown command, I do an ls -l and see that the two directories appear to be still owned by root (the group is root as well). Even though I am performing the chown command as root, the chown command does not appear to change the owner and group of the two directories to oracle:oinstall

After a suggestion was made to me to execute an ls -ld (as root) on the root directory, I got the following results:

Code:
root@solaris://>ls -ld /u01/app/oracle /u02/oradata
drwxrwxr-x 2 oracle oinstall 2 Feb 21 05:36 /u01/app/oracle
drwxrwxr-x 2 oracle oinstall 2 Feb 21 05:36 /u02/oradata

I was surprised to say the least, as when I executed an ls -l from the root directory as root, I got the following results:

Code:
root@solaris://>ls -l
total 1042
lrwxrwxrwx 1 root root 9 Oct 4 23:41 bin -> ./usr/bin
drwxr-xr-x 5 root sys 8 Oct 4 23:41 boot
drwxr-xr-x 2 root root 5 Oct 5 00:33 cdrom
drwxr-xr-x 254 root sys 257 Feb 21 12:39 dev
.
.
.
drwxr-xr-x 3 root root 3 Feb 21 05:36 u01
drwxr-xr-x 3 root root 3 Feb 21 05:36 u02

I exited from the root role and back to my user account, and then executed an ls -ld from the root directory and got the same results as above, showing the oracle and oinstall as the owner and group, respectively. I then executed an ls -l from the root directory and the results showed root and root as the owner and group. Can anyone enlighten me on what the difference is between ls -l and ls -ld that would show the owner/group for ls -l as root:root and the owner/group for ls -ld as oracle:oinstall? Is there any way to tell whether root:root is the owner:group of the two directories or is oracle:oinstall the owner:group of the two directories?

I appreciate any suggestions that one can make, many thanks in advance for your assistance.

Last edited by Scrutinizer; 02-23-2013 at 02:18 AM.. Reason: code tags
This User Gave Thanks to PWN For This Post:
# 2  
Old 02-22-2013
The ls -l is showing you the information about the contents of the directory, ls -ld shows you information about the directory itself.
Play around with it on some other directories that have subdirectoires and you see what I mean.
This User Gave Thanks to spacebar For This Post:
# 3  
Old 02-23-2013
Try doing a:
Code:
ls -l /u01/app /u02

Code tags aside, that is a well written question, BTW..
This User Gave Thanks to Scrutinizer For This Post:
# 4  
Old 02-23-2013
Quote:
Originally Posted by PWN
Code:
# chown -R oracle:oinstall /u01/app/oracle
# chown -R oracle:oinstall /u02/oradata

... <snip> ...

I was surprised to say the least, as when I executed an ls -l from the root directory as root, I got the following results:
Code:
root@solaris://>ls -l
... <snip> ...
drwxr-xr-x 3 root root 3 Feb 21 05:36 u01
drwxr-xr-x 3 root root 3 Feb 21 05:36 u02

There should be no cause for surprise. If you ask chown to recursively change the ownership of a directory, /a/b/c, chown will change the ownership of that named directory and any files and directories below it, such as /a/b/c/d and a/b/c/d/e. It will not change the ownership of files or directories above /a/b/c, such as /a and /a/b.

What you've demonstrated above is equivalent to using chown on /a/b/c and then using ls to inspect the ownership of /a. /a will not be affected.

Regards,
Alister
This User Gave Thanks to alister For This Post:
# 5  
Old 02-23-2013
I think your problem is more one of understanding, not of not achieving what you want to do. I have quoted the relevant part:

Quote:
Originally Posted by PWN
Code:
root@solaris://>ls -ld /u01/app/oracle /u02/oradata

I was surprised to say the least, as when I executed an ls -l from the root directory as root, I got the following results:

Code:
root@solaris://>ls -l

The command "ls" shows information about files and/or directories. That means, your first command showed information about two directories you specified as arguments to the command: /u01/app/oracle and /u02/oradata.

In the second line you specified no such operand. In this case "ls" implies the current directory (also called PWD) as operand. As suggested by your prompt this was probably / and by issuing "ls" without any argument you did effectively this:

Code:
root@solaris://>ls -l /

Of course, / has different ownerships than /u01/app/oracle and /u02/oradata, but this is to be expected.

To confirm this, try the following:

Code:
root@solaris://>cd /u01/app/oracle
root@solaris:/u01/app/oracle/> ls -ld

and you will see the corresponding output to ls -ld /u01/app/oracle (similar for the other directory). The reason is simply that by changing your current directory with the "cd" (change directory) command first you changed the default value for "ls" in absence of any directory name provided on the command line.

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
# 6  
Old 02-23-2013
Hi Alister, Bakunin: thanks very much for your replies. As I read each reply, the light went on and I totally agree with what each of you said.

Alister, allow me to summarize your answer and how I was able to solve my problem. Assuming I have logged in and su - root, and have cd to the root directory, I execute the chown -R oracleSmilieinstall on /u01/app/oracle. This in effect is the same as the example in your answer, to chown -R /a/b/c. What I have in fact requested is to recursively change the owner & group on on directory "c" and below, i.e. changing the owner & group for the "oracle" directory. However, this leaves root root as the owner & group of the u01 and app directories. What I really wanted to achieve is to change the owner & group of the u01, app, and oracle directories to oracleSmilieinstall. To do this, I executed the chown -R u01 and and low & behold, after executing an ls -l, the owner & group of u01 is now oracleSmilieinstall. I have done the same for the u02 directory.

Again, I appreciate the time you took to read my question and summarize what was a lack of understanding on my part. Thanks very much!
# 7  
Old 02-23-2013
Happy to help. You're very welcome.

Regards,
Alister
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. AIX

df question

Hi, Can anyone please explain a little about df command. I have following question: Following example is showing % used as 4 where as total free blocks are 15.46 out of 16.00 MB blocks. df -m /test Filesystem MBblocks Free %Used Iused %Iused ... (5 Replies)
Discussion started by: itsabhi9
5 Replies

2. Hardware

question

How to add 3 moniters to a pc set up? (2 Replies)
Discussion started by: clicstic
2 Replies

3. Shell Programming and Scripting

question about wc

Hey my friend was asking me if i knew a way to cout how many different words in a file. I told him no not off hand, but i was thinking about it, and i started to wonder also. I imagine this is probably pretty simple im just missing something, I keep confusing my self with how you would compair and... (16 Replies)
Discussion started by: yodadbl07
16 Replies

4. UNIX for Dummies Questions & Answers

Question

hallo, ik heb hier een vraagje. hoeveel gebruikers kunnen er op 1 unix systeem. hopelijk antwoorden golle nu want ik moet da vinde voor school en die leerkracht zaagt. :p groetjes eu wacht wa was mijne nick ah ja vraagje groetjes vraagje ik kan geen engels dus antwoord liever in het... (1 Reply)
Discussion started by: vraagje
1 Replies

5. UNIX for Dummies Questions & Answers

mv question

Hello if I like to move file from defined directories system to new directory that not contained any directories system structure . But I like to create the same file system structure as source directory for example : I have 2 directories: foo1 and foo2 foo1 have directories and foo2 have... (2 Replies)
Discussion started by: umen
2 Replies

6. Solaris

vi question

Im trying to edit a 113 meg file in VI and i get the error TMP FILE TOO LARGE. Does someone know how to get around this? Thanks! (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies

7. Programming

Yet Another Question

Now that I have getch() to work, I have yet another problem. BTW, thank you for answering these questions, I do ask a lot, only because I am eager to know, what is a board used for anyways :) Ok, he's the problem... #include iostream.h #include conio.h int main() { char movement; ... (2 Replies)
Discussion started by: mbolthouse
2 Replies
Login or Register to Ask a Question