Posts tagged ‘linux’

Mounting NTFS partitions as read-write on Ubuntu Linux

By default when you install ubuntu server and try to mount an ntfs file system you will only be able to mount it as a read only file system.

For example - I have attached a hard disk with a standard windows installation on device 1 (sdb) on my computer.

root@server:/dev$ ls
block            disk      input  loop3   mem                 pktcdvd  ram1   ram2  ram9    sda2  shm       tty    tty14  tty20  tty27  tty33  tty4   tty46  tty52  tty59  tty8     usbdev1.1_ep00  vcs1  vcsa1     zero
bus              ecryptfs  kmem   loop4   net                 port     ram10  ram3  random  sda5  snapshot  tty0   tty15  tty21  tty28  tty34  tty40  tty47  tty53  tty6   tty9     usbdev1.1_ep81  vcs2  vcsa2
cdrom            fd        kmsg   loop5   network_latency     ppp      ram11  ram4  rtc     sdb   sndstat   tty1   tty16  tty22  tty29  tty35  tty41  tty48  tty54  tty60  ttyS0    usbdev1.2_ep00  vcs3  vcsa3
char             full      log    loop6   network_throughput  psaux    ram12  ram5  rtc0    sdb1  sr0       tty10  tty17  tty23  tty3   tty36  tty42  tty49  tty55  tty61  ttyS1    usbdev1.2_ep81  vcs4  vcsa4
console          fuse      loop0  loop7   null                ptmx     ram13  ram6  scd0    sg0   stderr    tty11  tty18  tty24  tty30  tty37  tty43  tty5   tty56  tty62  ttyS2    usbmon0         vcs5  vcsa5
core             hpet      loop1  lp0     oldmem              pts      ram14  ram7  sda     sg1   stdin     tty12  tty19  tty25  tty31  tty38  tty44  tty50  tty57  tty63  ttyS3    usbmon1         vcs6  vcsa6
cpu_dma_latency  initctl   loop2  mapper  parport0            ram0     ram15  ram8  sda1    sg2   stdout    tty13  tty2   tty26  tty32  tty39  tty45  tty51  tty58  tty7   urandom  vcs             vcsa  xconsole
root@server:/dev$ mount
/dev/sda1 on / type ext3 (rw,relatime,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,nosuid,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
securityfs on /sys/kernel/security type securityfs (rw)

root@server:~# mkdir /mnt/ntfs
root@server:~# mount /dev/sdb1 /mnt/ntfs/
root@server:~# cd /mnt/ntfs
root@server:/mnt/ntfs# ls
AUTOEXEC.BAT  boot.ini  CONFIG.SYS  Documents and Settings  hiberfil.sys  IO.SYS  MSDOS.SYS  NTDETECT.COM  ntldr  pagefile.sys  Program Files  RECYCLER  sysprep_dat  System Volume Information  WINDOWS
root@server:/mnt/ntfs# touch hello.txt
touch: cannot touch `hello.txt': Read-only file system

To fix this problem all you have to do is install the ntfs-3g drivers on your machine - on ubuntu you can do that by using apt-get install - after that your file system mounts as read-write.

root@server:/mnt# sudo apt-get install ntfs-3g
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  fuse-utils libfuse2 libntfs-3g49
The following NEW packages will be installed:
...
root@server:/mnt# mount /dev/sdb1 /mnt/ntfs/
The disk contains an unclean file system (0, 0).
The file system wasn't safely closed on Windows. Fixing.
root@server:/mnt# cd /mnt/ntfs
root@server:/mnt/ntfs# ls
AUTOEXEC.BAT  boot.ini  CONFIG.SYS  Documents and Settings  hiberfil.sys  IO.SYS  MSDOS.SYS  NTDETECT.COM  ntldr  pagefile.sys  Program Files  RECYCLER  sysprep_dat  System Volume Information  WINDOWS
root@server:/mnt/ntfs# touch hello.txt
root@server:/mnt/ntfs# vim hello.txt
root@server:/mnt/ntfs# exit

Using Gmail SMTP server with wordpress

I finally got the time to figure this one out. It’s not that hard. Wordpress by default uses phpmailer for sending and getting emails via POP3. PHPMailer can either use php mail() function (default) or SMTP and is essentially an abstraction around POP3 and SMTP protocols.

The version that shipped with my version of wordpress 2.0.x was using an older version of phpmailer and does not support TLS/SSL. SSL is supported, however, by phpmailer 2.3, the current version - so this is what you do:

  1. Download the latest version of PHP mailer
  2. Pay special attention to 3 files - class.phpmailer.php, class.pop3.php and class.smtp.php
  3. The 3 files listed in (2) above are stored in the {wordpress intall dir}/wp-includes dir as class-phpmailer.php, class-pop3.php and class-smtp.php respectively (please note that the period (.) is replaced with a dash (-))
  4. Copy the downloaded class. files to the wp-includes folder as the class- files (sudo cp {phpmailer dir}/class.phpmailer.php {wordpress install dir}/wp-includes/class-phpmailer.php
  5. Repeat step 4 for the pop3 and the smtp class as well
  6. Next open the file {wordpress install dir}/wp-includes/class-phpmailer.php and make the following changes - a. update the $port to have a defaulat value of 465 not 25, update the $host to have a default value of “smtp.gmail.com”, update the $SMTPSecure to “ssl”, update $SMTPAuth to “true” and then the $Username and $Password fields
  7. Now edit the {wordpress install dir}/wp-includes/pluggable.php, navigate to the function ‘wp_mail’ change the line $phpmailer->IsMail() to $phpmailer->IsSMTP()

That’s it.

Now when someone registers on your website or when someone adds a comment - you should get your emails via gmail. Happy blogging.

Installing dual boot vista / ubuntu 8 on a dell inspiron1525 with 1395 wireless card

First off I am not a systems administrator. I am just a poor guy who had to read through 100 blog pages to get this working. I hope this helps other people - I will certainly take a look here again.

OK I have finally got this one right.Ever since I got my dell inspiron 1525 I have been itching to get ubuntu installed on it. The laptop came with windows vista professional installed and I first started by trying to install the dual boot directly via the hardy CD. The backup parition interfered with the installation and the resize of the partition failed half way, making my entire vista installation useless. It was aweful getting vista set up on this machine again. I had to install every single driver (yes even the display).

I formatted the entire disk and tried to run the ubuntu installer again, again without luck the resizing just got stuck. I was worried that I would have to insall vista again (OH no) - but luckily vista booted this time - nothing chkdsk could not fix. I figured this was never going to work - so I will enumerate the steps I took to get everything working right.

  1. Go to vista->computer->manage and then open the disk management
  2. Right click and resize the volume to a smaller size, this will then leave you with unformatted space
  3. Reboot and boot into the ubuntu installer, accept all defaults till you reach the partition selector
  4. The default option will be to install it by resizing the sda1 (or whatever parition vista is installed on). Another option would be to install on entire disk. Don’t choose them. You could either go into custom and create a custom swap, partition from the free space OR you could use the “largest continuous space” which is what I chose
  5. Let ubuntu install Continue reading ‘Installing dual boot vista / ubuntu 8 on a dell inspiron1525 with 1395 wireless card’ »