Commit a0c3aaf4 authored by Russ Fish's avatar Russ Fish
Browse files

Use Ops/FS as the Samba server. More tweaks.

parent 3c1a5bad
...@@ -171,7 +171,7 @@ sub doboot() ...@@ -171,7 +171,7 @@ sub doboot()
# server. All that's left is to CygWin mount the //fs directory paths. # server. All that's left is to CygWin mount the //fs directory paths.
if (WINDOWS()) { if (WINDOWS()) {
while (($remote, $local) = each %mounts) { while (($remote, $local) = each %mounts) {
my $host = "fs.bsd-fs.testbed.emulab.net"; ###"fs"; my $host = "fs";
print "Mount $local from //$host\n"; print "Mount $local from //$host\n";
os_samba_mount($local, $host, 0); os_samba_mount($local, $host, 0);
} }
......
...@@ -138,14 +138,23 @@ sub os_account_cleanup() ...@@ -138,14 +138,23 @@ sub os_account_cleanup()
os_accounts_sync(); os_accounts_sync();
} }
# Clean out the user /sshkeys directories. # Clean out the user /sshkeys directories, leaving /sshkeys/root alone.
$cmd = "$CHOWN -R root /sshkeys"; if (opendir(DIRHANDLE, "/sshkeys")) {
if (system($cmd) != 0) { while ($name = readdir(DIRHANDLE)) {
warning("Failed ($cmd): $!"); if ($name =~ m/^\.+/ || $name =~ m/^root$/) {
} next;
$cmd = "$RM -rf /sshkeys"; }
if (system($cmd) != 0) {
warning("Failed ($cmd): $!"); $cmd = "$CHOWN -R root /sshkeys/$name";
if (system($cmd) != 0) {
warning("Failed ($cmd): $!");
}
$cmd = "$RM -rf /sshkeys/$name";
if (system($cmd) != 0) {
warning("Failed ($cmd): $!");
}
}
closedir(DIRHANDLE);
} }
# Clean out the /proj directories. # Clean out the /proj directories.
...@@ -280,8 +289,9 @@ sub os_accounts_start() ...@@ -280,8 +289,9 @@ sub os_accounts_start()
return -1; return -1;
} }
if (! open(USERSHELLS, "> $usershellsfile")) { # Don't wipe out previous user shell preferences, just add new ones.
warning("os_accounts_start: Cannot create $usershellsfile .\n"); if (! open(USERSHELLS, ">> $usershellsfile")) {
warning("os_accounts_start: Cannot create or append to $usershellsfile .\n");
return -1; return -1;
} }
...@@ -578,6 +588,10 @@ sub os_samba_mount($$$) ...@@ -578,6 +588,10 @@ sub os_samba_mount($$$)
{ {
my ($local, $host, $verbose) = @_; my ($local, $host, $verbose) = @_;
# Unmount each one first, ignore errors.
$cmd = "$UMOUNT $local";
system($cmd);
# Make the CygWin mount from the Samba path to the local mount point directory. # Make the CygWin mount from the Samba path to the local mount point directory.
my $sambapath = $local; my $sambapath = $local;
$sambapath =~ s|.*/(.*)|//$host/$1|; $sambapath =~ s|.*/(.*)|//$host/$1|;
...@@ -598,7 +612,7 @@ sub os_samba_mount($$$) ...@@ -598,7 +612,7 @@ sub os_samba_mount($$$)
# mount: defaulting to '--no-executable' flag for speed since native path # mount: defaulting to '--no-executable' flag for speed since native path
# references a remote share. Use '-f' option to override. # references a remote share. Use '-f' option to override.
# Even with -E, exe's and scripts still work properly, so put it in. # Even with -E, exe's and scripts still work properly, so put it in.
$cmd = "$MOUNT -E $sambapath $local"; $cmd = "$MOUNT -f -E $sambapath $local";
if (system($cmd) != 0) { if (system($cmd) != 0) {
warning("os_samba_mount: Failed, $cmd.\n"); warning("os_samba_mount: Failed, $cmd.\n");
} }
......
...@@ -18,11 +18,6 @@ uname -r > $iscygwin ...@@ -18,11 +18,6 @@ uname -r > $iscygwin
chmod g+w $iscygwin chmod g+w $iscygwin
chmod -f g-w /etc/emulab chmod -f g-w /etc/emulab
# Set up to run rc.cygwinxp-user as part of all logins.
regtool -s set \
/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Run/EmulabLogin \
'C:\cygwin\bin\bash /usr/local/etc/emulab/rc/rc.cygwinxp-user'
# Make sure the computer name is right, reboots to change it if necessary. # Make sure the computer name is right, reboots to change it if necessary.
nodeid=`$tmcc nodeid` nodeid=`$tmcc nodeid`
hostname=`/bin/hostname` hostname=`/bin/hostname`
......
...@@ -15,8 +15,7 @@ PATH=/usr/local/etc/emulab:/bin:$PATH ...@@ -15,8 +15,7 @@ PATH=/usr/local/etc/emulab:/bin:$PATH
export PATH export PATH
# Samba server. # Samba server.
###host=fs host=fs
host=fs.bsd-fs.testbed.emulab.net
# Explanation: Shares are local to the Win32 login session context. # Explanation: Shares are local to the Win32 login session context.
# We must process a user name and password for the first one to be opened, and it # We must process a user name and password for the first one to be opened, and it
...@@ -31,6 +30,10 @@ fi ...@@ -31,6 +30,10 @@ fi
# Get the password for the user. # Get the password for the user.
user=`id -un` user=`id -un`
# Root isn't a real login, use the swapper's login instead.
if [ $user == root ]; then
user=`tmcc creator | sed 's|.*SWAPPER=\([^ ]*\).*|\1|'`
fi
pswd=`tmcc accounts | awk '/^ADDUSER LOGIN='$user' /{print substr($0,index($0," PSWD=")+9,8)}'` pswd=`tmcc accounts | awk '/^ADDUSER LOGIN='$user' /{print substr($0,index($0," PSWD=")+9,8)}'`
if [ -z "$pswd" ]; then if [ -z "$pswd" ]; then
echo "No account for user $user, so no remote file access." echo "No account for user $user, so no remote file access."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment