Posts Tagged ‘unix’

Search for files by owner attribute

Written by jeff on . Posted in How To No Comments

I wanted to find all files associated with a particular owner.  The GUI find (CMD-F) on our server doesn’t have any “other…” attributes than the default ones. Don’t know why. However, you can do the search in Terminal.

find / -user

After pressing return, unix will ask for a username. It will search the entire system (/).

Continue Reading ...

Revised Login Script

Written by jeff on . Posted in Fixes No Comments

For anyone who runs a Macintosh lab, you must visit Mike Bombich’s website.  His advise, applications and scripts have made my life much easier and our labs running more efficiently.

Problem: Lately, I’ve had trouble with our student login not consistently working.  The student would log in and the OS would run the script.  However, if you brought up the finder window, there would be extra folders in the sidebar.  Those extras were folders referencing the previous login. Files saved to the desktop were actually not being saved to the current login desktop but the previous login desktop folder.

Solution: Here are the changes that I made to the script. Its not as efficient but I believe its more consistent. If you want to see Mike’s original script, go to his script website as he holds the copyright. I use the “refresh-default-homedir-savetmp.sh” script.

# Move the home directory
mkdir -m 755 “${tmpDir}/prevuser.$time”
ditto $defHome “${tmpDir}/prevuser.$time”

# Copy a new default home directory from the user template
rm -rf /Users/$1
/usr/bin/ditto -rsrc $defTemplate $defHome

# Change the ownership of the new home directory to the user logging in
/usr/sbin/chown -R student $defHome

Continue Reading ...

Leopard Security Annoyance #1

Written by jeff on . Posted in Fixes No Comments

Problem: Every time I open Audacity in the student (non-admin) user account, I get this message: “Program Name” is an application which was downloaded from the Internet. Are you sure you want to open it? This is a security feature so that you think twice before opening an application downloaded from the internet for the first time.  Normally the message goes away, but in a non-admin account, it will come back again and again.

audacity_download_warning

Solution: Short answer….Remove extended attributes.

Helpful info from Frank van Meurs (scroll down to the longest post) http://discussions.apple.com/thread.jspa?messageID=5799602

More helpful stuff from this post as well. http://forums.macnn.com/90/mac-os-x/357810/leopard-unix-permissions/

In admin account, using terminal

  1. Go to offending directory >  cd /Applications/Audacity/
  2. List directory contents in long format and with invisible files > ls -al
    ls-al
  3. Notice the (@) at symbol.  This shows that the file or directory has extended attributes.
  4. List the extended attributes in long format> xattr -l <filename or directory name>
    xattr-l1
  5. Delete attribute> xattr -d <attribute> <filename or directory name>
    xattr-d
  6. Confirm deleted attribute.
    confirm-xattr-d

help for xattr> xattr -h

usage: xattr [-l] file [file ...]
xattr -p [-l] attr_name file [file ...]
xattr -w attr_name attr_value file [file ...]
xattr -d attr_name file [file ...]

The first form lists the names of all xattrs on the given file(s).
The second form (-p) prints the value of the xattr attr_name.
The third form (-w) sets the value of the xattr attr_name to attr_value.
The fourth form (-d) deletes the xattr attr_name.

options:
-h: print this help
-l: print long format (attr_name: attr_value)

Continue Reading ...