krypted March 26th, 2005
Posted In: Mass Deployment, Windows XP
Mass Deployment, windows
The nireport command can be used to list all of the groups in a NetInfo structure. To use nireport, you will need to specify the domain and a directory (in that order). Optionally, you can also specify a timeout for the query (-T) and whether or not the domain should be treated as tagged (-t). So if your NetInfo domain were local then the following would show all of the groups in a 10.3 Server-based Open Directory:
nireport . /groups
The equivalent in 10.4 and up would then be:
dscl . -list /Groups
Or for users:
dscl . -list /Users
To then show all of the users in a group you could query niutil and then parse out the membership (this could be done in Workgroup Manager as well):
niutil -read . /NetInfo/root/Groups
If you’re looking for gid then it might be a little easier though, as you can use nifind:
nifind -v /users/gid=20
krypted March 8th, 2005
Posted In: Mac OS X Server
list all groups, NetInfo, nicl, nireport
When you purchase a new Apple computer, it always comes preloaded with a serial number. In order to add that serial number when you do a replacement of a mother board, you can use a tool from Apple’s GSX called Blank Board Serializer.
krypted March 7th, 2005
Posted In: Mac OS X
You can determine the name of a user who is logged in using a number of different methods. From the command line there are two commands that most commonly get used for this: logname and whoami. Each can be used without any arguments to return the name of the user running the command, a great way to debug scripts, or grab the name of a user. To use logname:
To use whoami:
krypted March 6th, 2005
Posted In: Mac OS X
Command line, log in, login hook, Mac OS X, who is logged in
Note: This article is now out of date. While the Apple Xserve RAID is still found in legacy installations, it has been replaced by the Promise RAID for new installations.
The most typical storage found in Xsan setups is the Apple XRAID. Any XRAID will work within an Xsan deployment. XRAID systems being used in an Xsan should have the maximum amount of RAM available, which is 512MB.
The Apple XRAID comes with 14 drive modules. Drive modules in an XRAID are split into two channels, each with 7 modules. Drive modules are just UltraATA or SATA enclosures for the Hard Drives used in an XRAID. XRAIDs are available in sizes up to 7TB. Due to the large amount of media, it can take 30 or more hours to format the RAID completely. While there are options that allow writing to the XRAID while it is formatting this is often going to cause a performance decrease on the XRAID.
Each controller of the XRAID has a serial port, a Gigabit Ethernet port and a Gigabit Fibre channel port. For best performance, both controllers should be used when using an Xserve RAID with Xsan.
This brings up the two main factors when planning the storage needs for an Xsan: speed and space. Space is typically the biggest choice made when purchasing storage devices. Since all of the Xserve RAIDs get their space aggregated to create two gigabits per Xserve RAID, the speed requirements can often mean a need for purchasing more Xserve RAIDs even when the extra space is not a requirement.
krypted March 5th, 2005
Posted In: Xsan
planning, Xsan, xserve raid
The exit command will close an MS-DOS prompt. It’s quick, dirty and easy to use. Exit.
krypted March 4th, 2005
Posted In: Windows XP
command, exit, ms-dos
The ftp command that runs on a Mac is similar to that from any other platform, including Windows – and not much has changed with regard to FTP for a long, long time. When using FTP you will login to an FTP server, then issue some commands, one of which will kill your session to the host. The commands you issue during an FTP session are issued in an interactive mode of the shell, where you are actually running them against the target server
- ls – list the contents of a directory on the FTP server
- cd – change the working directory on the FTP server
- pwd – show the current directory on the FTP server
- get – download files from the FTP server
- put – upload files to the FTP server
- account – include a password with your login information
- bye – terminate an ftp session and close ftp (or use disconnect to simply terminate a session)
- bell – make a cute sound after each file transfer is done
- chmod – change permissions
- delete – your guess is as good as mine (OK, you got me, it’s to delete a file off the server)
- glob – enable globbing
- hash – only functional in Amsterdam
- help – get help
- lpwd – print the local working directory for transfers
- mkdir – create folders on the FTP server
- rmdir – delete folders from the FTP server
- newer – only get a file if it’s newer (great for scripting synchronizations)
- nmap – use positional parameters to set filenames
- passive – use FTP passive mode
- prompt – allows the use of letters to automate answers to prompts
- rate – limit the speed of an upload or download
Notice the similarity between FTP commands and Mac OS X commands! This continues into repetition: in Mac OS X you can build commands to run automatically when you open a new shell. Using a netrc file you can do the same with opening an FTP session. The ~/.netrc file (or just netrc) is a text file that, like .bash_profile, lives in your home directory (aka – ~). The .netrc file allows FTP to perform automatic logins to FTP servers based on the name (not that there aren’t subcommands to do the same, but it allows you not to insert the password into your history or script).
Like .bash_profile, the .netrc will need to be created per user, which can be done with the following:
Because you’re going to put password information in there, let’s also restrict who can look at it:
chmod 700 .netrc
Now open your shiny new .netrc file and create a block of settings for each FTP
server you want to automate access for. This information will be the ftp server (machine), the username (login) and the password (yup, that’s the password). For example, the entire file could be:
You can also connect to a server using the following format with each command with each command:
Now that you can login without issue, let’s write a script to perform some routine tasks, such as keeping a web site up-to-date.
ftp -d krypted.com << ftpEnd
Or Downloading documents off of a website:
ftp -d krypted.com << ftpEnd
There are also some variables that you can use in the prompt:
- %/ – the current working directory of the FTP server
- %M – the hostname of the FTP server
- %m – the hostname only up to the .
- %n – the username used for the FTP server
Finally, you can also define macro’s in your .netrc file using macdef.
krypted March 3rd, 2005
Posted In: Mac OS X, Ubuntu, Unix
Automation, Command line, FTP, MAC
krypted March 2nd, 2005
Posted In: Business, Ubuntu, Unix
cvgather is a command in Xsan, located in the /Library/FileSystems/Xsan/bin folder that allows you to “gather”up all the relevant configuration information for your Xsan environment and save them into a compressed file. Use it, love it, even script around it as it could get you out of some serious issues if you find yourself in them.
krypted March 1st, 2005
Posted In: Xsan