Sponsored Content
Homework and Emergencies Homework & Coursework Questions How to verify all user home directories are writable only by their owner Post 302368707 by vbe on Thursday 5th of November 2009 11:44:15 AM
Old 11-05-2009
Look at this bit of code (the best would be that you use it and see its output...) and see if inspiration comes, it should with the Hints given to you...
Code:
#!/usr/bin/sh
cat /etc/passwd | awk -F: '{print $1}'|while read USER
do
 DATA=$(ll -ld ~$USER)
 F1=$(echo $DATA| awk '{print $1}')
 echo DATA=$DATA
 echo F1=$F1
 F2=$(echo $DATA| awk '{print $3}')
 echo F2=$F2
 # etc...
 # if [
 #
 #...
 #fi
done

 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Delete old home directories

I have a script that deletes obselete users from /etc/passwd then moves their home directories to another location. After 30 days, I need to delete the home directories that were moved to the new location. I would appreciate any ideas on how to delete the directories after the 30 days? (2 Replies)
Discussion started by: munch
2 Replies

2. Shell Programming and Scripting

Batch delete specific folder from user home directories

Hi! Need your help. How can I delete the cache folder of multiple user home directories via automatically executed shell script on a Mac OS X Server? Example: The userdata are stored on a Xsan Volume like this: /Volumes/Xsan/userdata/mike /Volumes/Xsan/userdata/peter... (2 Replies)
Discussion started by: nipodrom
2 Replies

3. Shell Programming and Scripting

How to verify all user home directories are writable only by their owner

Hi, I'm currently working on my school assignment on how to verify that all user home directories are writable only by their owner on Solaris with VMware. But I'm not sure why my codes take a very long time to display the results. My friend says it's the `su - $i -c "ls -ld" 2> /dev/null | grep... (1 Reply)
Discussion started by: NuuBe
1 Replies

4. Solaris

how to change /export/home/user dir to /home /user in solaris

Hi all i am using solaris 10, i am creating user with useradd -d/home/user -m -s /bin/sh user user is created with in the following path /export/home/user (auto mount) i need the user to be created like this (/home as default home directory ) useradd -d /home/user -m -s /bin/sh... (2 Replies)
Discussion started by: kalyankalyan
2 Replies

5. Solaris

How to unmount user home directories ??

I've allocated /exports for all user directories by making separate directories under /exports..... :rolleyes: now i need to unmount /exports . But i'm unable to do that.. How can i troubleshoot this issue. Thanks in advance:D (2 Replies)
Discussion started by: vamshigvk475
2 Replies

6. Shell Programming and Scripting

World writable home dirs

what is wrong with this script? I get: ./perm.sh: command substitution: line 21: unexpected EOF while looking for matching `"' ./perm.sh: command substitution: line 22: syntax error: unexpected end of file Script: #!/bin/bash for dir in `/bin/cat /etc/passwd | /bin/egrep -v... (4 Replies)
Discussion started by: greenja9
4 Replies

7. Solaris

Giving read write permission to user for specific directories and sub directories.

I have searched this quite a long time but couldn't find the right method for me to use. I need to assign read write permission to the user for specific directories and it's sub directories and files. I do not want to use ACL. This is for Solaris. Please help. (1 Reply)
Discussion started by: blinkingdan
1 Replies

8. UNIX for Beginners Questions & Answers

[Tip] Housekeeping Tasks Made Easy - User Home directories and Leftover Files

We have regularly questions about how to create users and user accounts. But regularly user accounts need to be deleted too. It is quite easy to delete the user account itself but usually the HOME directory of the user remains. It is good style to remove these directories but simply deleting... (3 Replies)
Discussion started by: bakunin
3 Replies
RFIO_CHMOD(3)						      Rfio Library Functions						     RFIO_CHMOD(3)

NAME
rfio_chmod, rfio_fchmod - change access mode of a directory/file SYNOPSIS
#include <sys/types.h> #include "rfio_api.h" int rfio_chmod (const char *path, mode_t mode); int rfio_fchmod (int s, mode_t mode); DESCRIPTION
rfio_chmod sets the access permission portion of the mode of a directory/file to the bit pattern in mode. rfio_fchmod is identical to rfio_chmod but works on the file descriptor s returned by rfio_open. path specifies the logical pathname relative to the current directory or the full pathname. mode is constructed by OR'ing the bits defined in <sys/stat.h> under Unix or "statbits.h" under Windows/NT: S_IRUSR 0000400 read by owner S_IWUSR 0000200 write by owner S_IXUSR 0000100 execute/search by owner S_IRGRP 0000040 read by group S_IWGRP 0000020 write by group S_IXGRP 0000010 execute/search by group S_IROTH 0000004 read by others S_IWOTH 0000002 write by others S_IXOTH 0000001 execute/search by others The effective user ID of the process must match the owner of the file or be super-user. If a directory is writable and has the sticky bit set, files/directories within that directory can be removed or renamed only if: the effective user ID of the requestor matches the owner ID of the file or the effective user ID of the requestor matches the owner ID of the directory or the file is writable by the requestor or the requestor is super-user. RETURN VALUE
This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, serrno is set appropriately. ERRORS
EPERM The effective user ID does not match the owner of the file and is not super-user. ENOENT The named file/directory does not exist or is a null pathname. EBADF s is not a valid file descriptor. EACCES Search permission is denied on a component of the path prefix or write permission on the file itself is denied. EFAULT path is a NULL pointer. ENOTDIR A component of path prefix is not a directory. ENAMETOOLONG The length of path exceeds CA_MAXPATHLEN or the length of a path component exceeds CA_MAXNAMELEN. SENOSHOST Host unknown. SENOSSERV Service unknown. SECOMERR Communication error. SEE ALSO
Castor_limits(4) AUTHOR
LCG Grid Deployment Team LCG
$Date: 2005/03/31 13:13:02 $ RFIO_CHMOD(3)
All times are GMT -4. The time now is 10:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy