Samba – Stop homes from showing in shares

When using Samba on Linux, there are times that you want to allow user to have a private user directory, but do not want the “homes” directory share to show up. This is relatively simple.

Edit your /etc/samba/smb.conf file with your favorite Linux editor.
Look for the section [homes] and find the line
browseable =

set this line to browseable = no

Restart Samba (>service smb restart) and your users should now see their personal directory without seeing the homes share.

If you do not have a [homes] section, here is an example on for you –>

[homes]
        hide dot files = no
        comment = Home Directories
        writeable = yes
        delete readonly = yes
        valid users = %S
        browseable = no

Initializing a new instance of Linux

After a fresh install of Linux, there are a number of tasks I like to do. I like having commands and aliases that I am used to installed.

Copy /opt/scripts

Create /opt/sw

/opt/scripts/stopUnusedServices.sh

set up MySQL

Install WebMin and VirtualMin for managing your domain names and their.

Connecting Red Hat 5.3 to a Dell MD3000i

Connecting to a DELL MD3000i is no trivial matter with Linux. First, you need to ensure that you have the DKMS package installed.

>yum -y install dkms
>yum -y install iscsi-initiator-utils
>yum -y install gcc
>yum -y install kernel-devel
>yum -y install sgpio
>yum -y install sg3_utils

Now you can install the Dell Tools and finish configuring your SAN.

Jasper Server Permission Denied error

Occasionally, Jasper Server has an error relating to being unable to write files. The errors show up in the Apache web server log, catalina.out.

You have probably started the service as the user root on accident. This will cause ownership to change to root on some log files. Then when you log back on as user jasper and restart your server, the Apache logs are filling with messages about not being able to write files. Jasper is just not working properly. Run the following command to restore the proper ownership to all files in the Jasper directory. You must run the following command as root:

>find /home/jasper/jasper-server-3.7 -user root -exec chown jasper.jasper {} \;

This will find all the files that root changed ownership and change the ownership back to the proper jasper user.

Determining a devices WWID in Linux

For multipath drivers connecting to storage area networks (SAN), it is useful in your /etc/multipath.conf to blacklist devices. This prevents the multipath driver from attempting to use the device(s).

To find out a drive’s WWID, run the following command:

>scsi_id -g -u -s /block/sda

This will return a WWID. On my system it was returned as 36001e4f034bf55000f98fe8606dc88df.

Now you can put this in the blacklist section of /etc/multipath.conf as:

blacklist {
devnode “^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*”
devnode “^hd[a-z]”
devnode “^sda”
devnode “^sda[0-9]”
devnode “^sdb”
devnode “^sdb[0-9]”
wwid    “36001e4f034bf55000f98fe8606dc88df”
device {
vendor DELL
product “PERC|Universal|Virtual”
}
}

This will now prevent the multipath driver from attempting to manage /dev/sdc.

Finding a count of files in a directory

In Linux, you can count all of the files in a directory, of a given type.

To do this run:

>find . -maxdepth 1 -type f -name “*.gz” | wc -l

If you want to count all of the gzipped files in all directories below your current directory. Run the same command without the -maxdepth:

>find . -type f -name “*.gz” | wc -l

Everything relies on the wc command, which is short for word count. We are counting the line by line output from the find command.

If you want to count the number of directories, try this:

>find . -type d | wc -l

Just remember to subtract 1 from the output. Linux will include the current directory (.) as a directory.

Linux log error – Could not receive trustdoms : xxx Time(s)

When using Samba with Linux, Red Hat Enterprise Linux attempts to connect to a Windows server that acts as the domain controller. This is called a trustdom; as Linux is attempting to build a trust relationship with a Windows Domain Controller. You will see the following message in your log:

——————— samba Begin ————————

**Unmatched Entries**

nsswitch/winbindd_util.c:trustdom_recv(243) Could not receive trustdoms : 288 Time(s)

———————- samba End ————————-

To stop this error message, you need to stop the winbind service. To do this, run the following commands:

chkconfig winbind off
service winbind stop

This will ensure that upon reboot, the service does not start. And the second command ensures that the service is stopped immediately.

Check your log tomorrow to ensure that you are no longer receiving this message.

QEMU seems to make Windows read-only

The Problem:

The server is acting all weird, thought i might raise a flag to you:
– after you said you attached the larger drive/partition, nothing changed
– when i logged on as administrator tonight, it acted like ive never logged on before
– the profile is fucked up somehow; i dont have any icons, no quick launch, none of the items i installed, etc.
– for some weird reason, i can’t download any files using a web browser when on the server.  i also cannot ftp any files to the server.  when i use ie to download an attachment from gmail for example, it can’t do it.  when i tried to download firefox, i also got an error about contacting the server.  very weird.  also, with full permissions, and full write access, i am unable to write any files to the server via ftp either.  me = confused.

Did you refresh the instance or something like that?

The Solution:

In this instance, a new virtual drive was added to a Windows 2003 Server running under a QEMU virtual machine on Linux. QEMU most likely has the virtual instance locked read-only because the new virtual drive has not been allowed to initialize itself under Windows. This stops Windows from being able to write to any file.

In this case the problem was resolved by forcing a power down on the instance. Then under the setting for the virtual machine on the Hardware tab, check that the new drive is in the list of hardware. If so, then start the instance. Log in as Administrator in Windows. Go to Control Panel – Administrative Tools – Computer Management. Once it opens, select Disk Management, and initialize and format the new drive.

If from above the new hardware is not in the list of Hardware Devices. Try reconnecting to the virtual disk you created, or just create a new virtual disk and attach it to the Windows instance.

Windows service failure while running in a QEMU virtual instance

If you are running Windows under QEMU and see Event ID 7000’s like these below–

If you get this Description:

“The Parallel port driver service failed to start due to the following error:
The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.”

Then you have the ParPort service not starting. This happens if you upgrade your W2K3, W2K, or NT server from hardware (motherboard) that HAD a Parallel Port, but are now on a new motherboard that has no Parallel Port.

The fix is simple:
1. Open Regedit and go to–
HKLM\System|CurrentControlSet\Services\Parport
2. Edit the Start key and change the value to 4. Changing the value to 4 will “disable” the service.
3. Reboot the server

You should no longer get that annoying popup dialog when Windows starts.