Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Wednesday, September 05, 2012

Portable undelete tool for NTFS volumes (quick and free)

It's been a while since I've had to do deleted file recovery from a machine, so I thought I'd post a short note based a recent conversation that I had with a friend of mine.  Incidentally, the last time I looked into this I  ended up using a Knoppix Linux Live CD.  But a quick search suggests... that the undelete business is alive and well.  So after trying a few disappointing tools, I found that Recuva met the need (it worked, it was portable, and it was free).  It did a fine job of quickly recovering most of the recently deleted files, but as expected - struggled on the ones that had been deleted a while ago (several weeks old).

Monday, January 25, 2010

Redmine: Email Configuration of Bitnami Appliance

If you need to configure Redmine so that it will send email notifications to users when they update issues, or projects this might be helpful configuration information. I’m using Redmine 0.8.7 as a Bitnami appliance running under OpenSuse 11.1.

The email configuration is located in this directory: /opt/bitnami/apps/redmine/config . What I recommend is that you copy the example configuration file from email.yml.example to email.ym, and edit the email.ym configuration file with vi. I didn’t see any of the more user-friendly editors like pico, or nano pre-installed on the appliance so you can install them, or just use vi… it really isn’t that difficult to use. If you need a good tutorial you can check out Wikipedia's vi info. In any event, edit the file using vi… “vi email.ym”.. Press “a” to enter edit mode and make the below changes, then press colon “:”, and type “x!” and hit enter to write and exit. If you made a mistake, and want to abandon your changes type “q!” and hit enter to quit. After you’re finished, just restart the Redmine services (or the server).

Also, make sure that your SMTP server is setup to either allow relay from the IP of your Redmine server, or make other arrangements for SMTP delivery.

Production:
delivery_method: :smtp
smtp_settings:
address: SMTPServerIP
port: 25
domain: yourdomainname.com
authentication: :login
user_name: ServiceAccountRedmine01
password: SavedPassword

Thursday, March 12, 2009

Mounting a remote SSH file system in Ubuntu... for Windows Admins

If you're somewhat new to Ubuntu or Linux you might be looking for a way to mount something like a file share the way we would a network drive in Windows. You know... mount a Z: drive, and then browse, and modify the contents of that drive as if it were local. Well, because Ubuntu is really friendly - you probably don't have to learn a whole lot to actually start getting useful things accomplished (in Ubuntu, Places>Connect to Server gives you most of what you need). But – did you know you can also securely mount a remote file system via SSH and have it look and feel local? Or perhaps you don't know what SSH is. If this is you – then check out this mini how-to. Nothing in here is particularly difficult... but there's enough here and linked-up to more expansive how-to's as to possibly be eye-opening for you.

What do you get out of following this tutorial?

You get a secure Linux alternative to a Windows network drive mapping that works works well... especially over slow connections (VPN tunnels, modems, etc.), and that you can essentially treat as a local resource. After that, you can do even more useful stuff like use grsync/rsync to replicate differences between directory structures. If this is all new to you, you'll also get some useful exposure to openssh, scp, Putty, and SSHFS.

How-To

  1. Install the openssh server and client on the server, and the client on the client. Just use “sudo apt-get install openssh-server openssh-client”.... Like this

  2. Install putty on your client (this isn't strictly necessary - but useful for troubleshooting)...

    1. 'sudo apt-get install putty'.

  3. On your server, consider changing the the default port in SSH from 22 to something else (like 512).

    1. 'sudo editor /etc/ssh/ssh_config"... change the 'port 22' to 'port 512'... then issue a restart of ssh... 'sudo /etc/init.d/ssh restart'.

  4. If you're using a firewall on the server, make sure you open that new port you just created in the previous step.

    1. If you're using"firestarter" in Ubuntu, open Firestarter ( System>Administration>Firestarter). Go to policy, and add an "inbound traffic policy" and let that new port (e.g. 512) in from your network (or perhaps something more restrictive that makes sense).

  5. Putty on your client (from a shell, just type 'putty'). Now determine the IP address of your host server, and point putty at it, on the correct port and connect. It will prompt you for credentials... now you have remote telnet-like access to the remote box. In other words, all we're doing here is proving to ourselves ythat the "server" from earlier steps is actually working correctly.

  6. For good measure, try doing a scp from your client to the server (learn how SCP works).

    1. 'scp -p 512 /home/username/somefilethatexists.txt username@remotehostIP:/home/path/NewFileOnThisSystem.txt'.

    2. In the above, I'm specifying 512 for my port, and the username@remotehostIP is me forcing the right username... if I didn't do this, it would automatically attempt to use the username of the currently logged-in account on the client .

  7. At this point you've more than proven that everything works right (steps 5, 6). So the last steps are mounting and using that remote filesystem. The credit for the remainder of this goes to this older post by Carthic... but my cliffnotes follow below.

  8. Install sshfs ('sudo apt-get install sshfs'... note that this auto installs fuse as well).

  9. Now create the mount point on the client ('sudo mkdir /mnt/remotecomputer', and make yourself the owner... 'sudo chown yourusername /mnt/remotecomputer')

  10. Now add your username to the fuse group that was auto-created in step 8.

    1. 'sudo adduser yourusername fuse'. Or in Ubuntu, System>Administration>Users and Groups

  11. Log-out and log back in (users can't run the fuse binary).

  12. Finally - just mount that SSH filesystem off of the mount point you created earlier...

    1. "sshfs -f -p 512 username@ipaddress:/home/path /mnt/remotecomputer".

    2. It will prompt you for a password... type it, and now you can browse the file system of the remote server by doing an "ls /mnt/remotecomptuer" from your client. The remote file system works just like it's local... you can open and edit those remote files modify them locally and when you save them, they save to the destination server.

Now that you've got everything working correctly, you can do fun stuff like setup grsync/rsync if you actually want to replicate files from the “server” to your client (perhaps for doing easy backups over the WAN)... or if you didn't have exposure to SSH until now, you've got an easy to do remote control. Hope you found this interesting and useful.

Saturday, February 23, 2008

Automating Restores for Deki Wiki

If you've got your backup script running for Deki Wiki, and stakeholders are busy adding knowledge - it might be time to build a test environment if you haven't already. After the backup of the production server runs, we're restoring the attachments, and .sql file to our test box. There are some obvious benefits of having a test environment, including...

  1. We have a tested and automated restore procedure that we know works because it happens every day
  2. A box we can test stuff without having to worry about breaking a production box
All you need to do is build out your test box following the same procedures as your production box, then modify your backup script to become a restore script like so... and then schedule the script to run as a cron job.


#!/bin/bash
today="$(date +%a)"

#mount Windows Share
sudo -u root -p password smbmount //server/share /mnt/subdir -o username=user,password=password,rw

#copy down Today's database and attachments
cp /mnt/share/$today.wikidb-backup.sql /home/user/tmprestore
cp /mnt/share/$today.attachments-backup.tar.gz /home/user/tmprestore

#restore Today's database and attachments
cd /home/user/tmprestore
sudo mysql -uroot -ppassword wikidb < $today.wikidb-backup.sql cd /var/www/deki-hayes sudo tar xvzpf /home/user/tmprestore/$today.attachments-backup.tar.gz

Monday, February 04, 2008

Getting daily backups running in Deki Wiki

The backup and restore process for Deki Wiki is pretty easy. No backup agents, no fights, just a short script and a tested procedure.

Dump your database to a .sql file, archive the attachments, put it in a bash script, and schedule it via the root Crontab (sudo crontab -e).

The script linked above is the 95% solution. The only thing you really need to do is have a share on another box somewhere mounted in the /mnt directory. So create a subdirectory “/mnt/backup”, and then use smbmount to mount the new share off of that subdirectory. Just make sure that the credentials you specify with smbmount exist on the target box. Something like this will work in a pinch...

#!/bin/bash
today="$(date +%a)"

#mount Windows Share
smbmount //windowsbox/apps /mnt/backup -o username=username,password=password,rw

#dump today's database
mysqldump -uroot -psqlrootpass wikidb > /mnt/backup/wiki/$today.wikidb-backup.sql

#dump today's attachments
cd /opt/deki-hayes/
tar czf /mnt/backup/wiki/$today.attachments-backup.tar.gz attachments

#Log the job status
echo "Nighly Backup Successful: $(date)" >> /var/log/dekiwikibackup.log


Friday, January 18, 2008

Ubuntu: Start the Virtual Machine Additions during startup

If you followed the last post, you might want to configure the vm-additions to run at startup. The Ubuntu-way of making this happen is documented here.

The short version is as follows: (note the trailing ... "S .")

$ sudo update-rc.d vmadd start 51 S .
$ sudo update-rc.d vmadd-heartbeat 51 S.
$ sudo update-rc.d vmadd-timesync 51 S.

Thursday, January 17, 2008

Getting Virtual Machine Additions (for Virtual Server) to work in Ubuntu 7.10

As anyone who’s worked with Linux distros under Virtual Server 2005 R2 SP1 can attest, getting them running is not particularly fun. Assuming you get past video problems, and can get your guest built, you then have to contend with limited support for vm-additions, CPU utilization problems, and the like. With apparent Linux-support improvements forthcoming, you might be able to wait. But if you can’t wait, it is possible to get the vm-additions installed and working in Ununtu. The key to making this work is converting the RPM’s to DEB packages via alien. Despite forum posts to the contrary, it will work.

After you’ve got your Ubuntu guest installed and running, grab a copy of the vm-additions and either mount the ISO in the guest via the management console, or just extract and copy the RPM’s over to the guest instance via SMB . After doing so, use alien to convert the RPM files to .DEB files, like so:

“$ sudo alien -k --script vmadd-full-2.0-1.i386.rpm”

Now that you’ve converted them, you should have *.DEB files in the directory you were working in. Go ahead and launch your package installer (e.g. GDebi Package Installer), and install vmadd-full-rhel_2.0-1_i386.deb. It should display a message to the effect of … “The Microsoft VM additions… (converted by alien)”. At this point, Gnome crashed on me (down at the bottom of VMAdditionsForLinux-README.txt in the vm-additions ISO it refers to having to exit the GUI). I’m telling you this because Gnome crashing doesn’t necessarily mean it’s broken.

If you’ve reached this point, for good measure check the install log.

It lives here… /var/log/vmadd-install.log

The only thing left to do would be test it…

“$ /etc/init.d/vmadd start”
“$ /etc/init.d/vmadd-heartbeat start
“$ /etc/init.d/vmadd-timesync start

Wednesday, January 16, 2008

DekiWiki - Active Directory Integration

As far as Active Directory integration with Dekiwiki goes, it's actually not too difficult to setup.

First, they've got some setup instructions here, plus they have active forums.

The only problem I ran into with the instructions was with the searchbase syntax in the configuration. The instructions make it appear that you should specify the hostname twice… once in the hostname configuration, and then again as part of the Distinguished Name (DN) that you’re providing for searchbase. For instance, I was specifying “dc=DCServerName, DC=domain, DC=local. On the client side (the web interface), authentication attempts were failing, but while watching DCServerName’s security log, it showed successful authentication attempts coming from the Dekiwiki box.

To resolve this, all I did was remove the dc=DCServerName from the searchbase. Once I removed it, such that the searchbase configuration was dc=domain, dc=local –it worked.
As an aside, all of this was done in a standard SBS 2003 R2 environment. Nothing extra or special required on the SBS server.

Thursday, April 05, 2007

Linux: Compiz and Beryl are merging!

Check it out - Compiz and Beryl and merging! While not my typical blog-fare, it's exciting news. If you have no idea what I'm talking about (and why should you - this isn't much of a Linux blog) they're compositing window managers that put 3D OpenGL acceleration into your X Windows System GUI (like KDE and Gnome).

In other words, it lets you do some neat stuff... like spin the desktop cube - among other things (like sliding window effects, snow, and other neat 3D effects.). Check out some video's that demonstrate what I'm referring to. It's kind of like the Vista slide-deck multiplied by 100.

What if you're new to Linux? Just choose a distribution and go - it's all so much easier than it was 10 years ago - it shouldn't take long to get up and running.