(no subject)

Apr 12, 2010 22:17

I personally believe that removing NetInfo manager was a big mistake on Apple's part. While it may not have been the easiest and the friendliest apps, the alternative is a seemingly poorly documented, buggy and unintuitive interface called dscl. In addition some of the functionality has also been moved to other applications. I say seemingly poorly documented because I am sure it is documented somewhere it is just difficult to find. I say buggy because it is, the shell tends to crash and die a lot for strange reasons, so don't use the shell. Also the shell and command line have some differences, with the shell the settings I need are in /Local/Default/* (e.g. /Local/Default/Mounts), where is on the command line you get to bypass all that and just go to the specific directory. However on the command line you must specify if you are connecting to a local directory.

sudo dscl . -command argument1 argument 2 ... argument n

So....
Here is my collection of dscl knowledge I have acquired so far:

Chnage Example:
sudo dscl . -change /Mounts/192.168.0.101\\:\\/media\\/sda2\\/Pictures RecordName "192.168.0.101:/media/sda2/Pictures" "192.168.1.101:/media/sda2/Pictures"

NFS Creation Example:
sudo dscl . -create /Mounts "192.168.1.101:/data/Music"
sudo dscl . -append /Mounts/192.168.1.101\\:\\/data\\/Music VFSLinkDir /Network/Servers/
sudo dscl . -append /Mounts/192.168.1.101\\:\\/data\\/Music VFSOpts -P -i net
sudo dscl . -append /Mounts/192.168.1.101\\:\\/data\\/Music VFSType nfs

sudo dscl . -create /Mounts "192.168.1.101:/data/Pictures"
sudo dscl . -append /Mounts/192.168.1.101\\:\\/data\\/Pictures VFSLinkDir /Network/Servers/
sudo dscl . -append /Mounts/192.168.1.101\\:\\/data\\/Pictures VFSOpts -P -i net
sudo dscl . -append /Mounts/192.168.1.101\\:\\/data\\/Pictures VFSType nfs

sudo dscl . -create /Mounts "192.168.1.101:/data/Video"
sudo dscl . -append /Mounts/192.168.1.101\\:\\/data\\/Video VFSLinkDir /Network/Servers/
sudo dscl . -append /Mounts/192.168.1.101\\:\\/data\\/Video VFSOpts -P -i net
sudo dscl . -append /Mounts/192.168.1.101\\:\\/data\\/Video VFSType nfs

Group example
sudo dscl . -create /Groups linuxnfsuser
sudo dscl . -append /Groups/linuxnfsuser Password *
sudo dscl . -append /Groups/linuxnfsuser PrimaryGroupID 2000

Results in:
mac:~ lev$ sudo dscl . -read /Groups/linuxnfsuser
AppleMetaNodeLocation: /Local/Default
GeneratedUID: 270DF502-F1DF-4E5D-93F7-EDA5D39C8894
Password: *
PrimaryGroupID: 2000
RecordName: linuxnfsuser
RecordType: dsRecTypeStandard:Groups

sudo dscl . -append /Groups/linuxnfsuser GroupMembership user1
sudo dscl . -append /Groups/linuxnfsuser GroupMembership user2

Results in:
mac:music lev$ sudo dscl . -read /Groups/linuxnfsuser
Password:
AppleMetaNodeLocation: /Local/Default
GeneratedUID: 270DF502-F1DF-4E5D-93F7-EDA5D39C8894
GroupMembership: user1 user2
Password: *
PrimaryGroupID: 2000
RecordName: linuxnfsuser
RecordType: dsRecTypeStandard:Groups

Obviously for this to work the linux NAS has to have corresponding users and groups, obviously at this point the logical conclusion is that NFS is no the most secure system in the world. If I can get root on the box I can fake a user and group. And then I can just bring in my own box and fake the right user/group.

mac os x dscl netinfo sucks shit poor se

Previous post
Up