how to display the permission of the home directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to display the permission of the home directory
# 8  
Old 04-15-2008
Works for me Smilie
Can you provide a sample line of your /etc/passwd file.
# 9  
Old 04-15-2008
ls doesn't normally read input from a pipe. Try this.

Code:
awk -v v=$1 -F: '$1==v {print $6}' /etc/passwd | xargs ls -ld

or, more or less equivalently

Code:
ls -ld `grep $1 /etc/passwd | cut -d: -f6`

You seem to have misplaced the backticks in your original code. Note, those are not regular apostrophes, but grave ones (ASCII code 96).
# 10  
Old 04-15-2008
You probably don't need to use /etc/passwd to find a user's home directory because the shell will expand ~username for you. Try...
Code:
eval ls -lapd ~$1

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

SunOS confusing root directory and user home directory

Hello, I've just started using a Solaris machine with SunOS 5.10. After the machine is turned on, I open a Console window and at the prompt, if I execute a pwd command, it tells me I'm at my home directory (someone configured "myuser" as default user after init). ... (2 Replies)
Discussion started by: egyassun
2 Replies

2. AIX

How to set owner and permission for files/directory in directory in this case?

Hi. My example: I have a filesystem /log. Everyday, log files are copied to /log. I'd like to set owner and permission for files and directories in /log like that chown -R log_adm /log/* chmod -R 544 /log/*It's OK, but just at that time. When a new log file or new directory is created in /log,... (8 Replies)
Discussion started by: bobochacha29
8 Replies

3. Red Hat

Mkdir: cannot create directory `/home/phpmy/html': Permission denied centos

for incompatibility installation problems, I've decided to reinstall Centos 6.3 as can be seem from the df output, I've partitioned both / and and /home directories $ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda8 12G 5.3G 6.5G 45% / tmpfs ... (2 Replies)
Discussion started by: jediwannabe
2 Replies

4. BSD

FreeBSD abnormal permission changes in /home

Hi, I have a bit of a headache with a server doing some rather mysterious yet static changes to permissions in /home. The server in question is a FreeBSD server. It's an older beast with quite a few custom tweaks and now I'm stuck with it :-) The problem is that some of the directories in... (2 Replies)
Discussion started by: brightstorm
2 Replies

5. HP-UX

could not able change permission of /home dir

Hi i am new to this admin area . i have created user with name as "ab" and gave home dir as /home/ab . when i tried to create the /home/ab dir , i got he following error. "mkdir: Failed to make directory "/home/ab"; Operation not applicable " Thanks in advance . (1 Reply)
Discussion started by: expert
1 Replies

6. UNIX for Advanced & Expert Users

about the access permission of users home directory

RHEL5.0 As we know, when root create a new user, a new home directory will be created : /home/user I want to know what determine the access permission of /home/user . Thanks! (1 Reply)
Discussion started by: cqlouis
1 Replies

7. Solaris

Restricting SFTP user to a defined directory and home directory

Hi, I've created solaris user which has both FTP and SFTP Access. Using the "ftpaccess" configuration file options "guest-root" and "restricted-uid", i can restrict the user to a specific directory. But I'm unable to restrict the user when the user is logged in using SFTP. The aim is to... (1 Reply)
Discussion started by: sftpuser
1 Replies

8. UNIX for Dummies Questions & Answers

Root cannot change /home permission

Folks; I'm a root but i couldn't change /home directory permission or group. i'm getting operation not permitted. Any help? (6 Replies)
Discussion started by: moe2266
6 Replies

9. UNIX for Advanced & Expert Users

ssh home directory permission

Hi All, I am using sftp to transfer files between two unix machines. As per my knowledge, in order to use public key authentication, the remote user's home directory permission should be set to 750 ( basically group and others should not have write permission ). Is there any way to over ride... (1 Reply)
Discussion started by: shihabvk
1 Replies
Login or Register to Ask a Question