Wednesday, May 27, 2009

Failed to modify password entry for user while adding user with smbpasswd

I was trying to create a user today in samba and was getting the error "Failed to modify password entry for user [USER]".

I read over the man pages for smbpasswd and saw that I needed to add the -n switch because this user will not have a password. So again I tried to add the user with "smbpasswd -a -n [USER]" and got the same error.

A quick Google search lead me to a newb mistake on my part... I didn't have the user I was trying to add in my UNIX password file. A quick "useradd [USER]" followed by the same "smbpasswd -a -n [USER]" and I was all set.

Granted there are other reasons why this process might fail, but for me this was the reason.

Friday, May 22, 2009

A simple file shredder for Windows

Working with sensitive data all day long you come to realize that what I download needs to be deleted securely, just as the paper copies need to destroyed securely.

I happened upon this script on Lifehacker a while ago, but I have been using it more and more lately.

First you will need to download sdelete from Microsoft. I copy this exe to the Windows directory on each machine as part of my install process.

The script if very simple:
@echo off
FOR %%F IN (%1 %2 %3 %4 %5 %6 %7 %8 %9 %10) DO sdelete -p 7 -s %%F

I save this as shred.cmd and place it in my C:\Scripts folder. It will take up to 10 files at a time and run sdelete with 7 passes on each file. Sdelete will also rename the file 26 times to obfuscate the file name.

About once a month I will run sdelete -p 3 -z to clean the free space on my PC and to make sure that any temp files I didn't shred are cleaned up. Now this won't obfuscate the file names at all, but the contents of the files are gone for good.

You can also place a short cut to the shred.cmd file into your Send To menu options and have an easy way to clean files from any folder.

Adding programs to the "Send To" menu

From time to time I write small scripts that accept Command line arguments. In the past I kept shortcuts to them on my desktop, but today I wanted to remove all icons from my desktop.

If you open up %APPDATA%\Microsoft\Windows\SendTo in Windows Explorer.

You see %APPDATA% is an environment variable that usually maps to something like C:\Documents and Settings\[YOUR USER PROFILE]\Application Data\ in Windows 2000/XP and "C:\Users\[YOUR USER PROFILE]\Application Data\" in Windows Vista.

Let's say you wanted to add an item to the Send To menu to shred files with sdelete. You could just drag a shortcut to the shred script this folder, or create a new shortcut.

This method should work for any application that allows you to open a file by using a command line argument.

Wednesday, May 06, 2009

mail command returns fseek Invalid argument, panic temporary file seek

Today I logged into one of our older servers, haven't logged into it for a while and saw that there was new mail (as always given the number of cron jobs running).
Below is the output of my command.

[root@server /]# mail 
"/var/spool/mail/root": 1832 messages 1777 new 1832 unread 
fseek: Invalid argument 
panic: temporary file seek

After a little bit of searching online I found two possible and simple solutions.
If you want to read the mail try using mutt instead of mail. It doesn't have a problem with the 2GB file size of the mail box that mail did.

If you don't care about the old stuff you can run:
rm -f /var/spool/mail/root
to remove the file and then
cat /dev/null > /var/spool/mail/root
to recreate a blank file.  

I ended up reading the mail I wanted and then blowing the file away.  But before I could recreate it there was already a new file with 62MB of mail in it.