Categories
Uncategorized

A Quick Tutorial to Set Up an NFS Server on Windows

Update (Nov 9, 2011): As noted in the comments below, Windows Services for UNIX Version (SFU) is no longer supported on Windows 7 and 2008. For these versions, try installing Cygwin with the optional nfs-server component. If you’re using Windows 2008, you can use the Server for NFS that comes built-in instead – in this case, most of the steps below should apply.

A few days ago, I needed to share a large folder present on a Windows server to access it from my local Ubuntu workstation. I initially used Samba, but my build script refused to recognize paths present in that share.

The solution was to use an NFS share – but this required a special setup on Windows. Even after a lot of searching on Google, I couldn’t easily find a guide that talked about how to get started with an NFS server on Windows quickly. Most articles I came across were only detailing information on NFS security, or some obscure command line options for tweaking NFS options – which shouldn’t be required when all you want is a simple share within your local, protected network.

So, here’s what to need to do if you need an NFS server enabled on Windows quickly, and mount it on your Linux box:

1) Download Windows Services for UNIX from Microsoft’s Download Center. Here’s the direct download link.

2) Run setup.exe from the extracted directory.

Welcome to the Microsoft Windows Services for UNIX Setup Wizard

3) Follow the prompts, until you reach the following screen:

Installation Options

Choose custom installation – since we’d like to only install the NFS server for sharing folders.

4) Choose the following three components to install:
(i) NFS -> Server for NFS
(ii) Authentication tools for NFS -> User Name Mapping
(iii) Authentication tools for NFS -> Server for NFS Authentication

Here’s a pictorial representation of the components you’ll need:

Selecting Components   Selecting Components

5) On the next screen, choose to change the behavior to case-sensitive, to provide full compatibility with UNIX programs

6) On the User Name Mapping screen, choose “Local User Name Mapping Server” and “Password and group files”:

User Name Mapping

7) Now, copy your passwd and group files from your UNIX/Linux distribution onto your Windows machine. For Ubuntu, these are located at /etc/passwd and /etc/group. Provide the paths to these files in the next screen:

User Name Mapping Configuration

8) Continue with the installation prompts until you finish.

Installation...

9) Windows Services for UNIX should now be installed:

Windows -> All Programs

10) Open the Services for UNIX Administration shortcut, and click on User Name Mapping:

User Name Mapping on local computer

11) Click on “Show User Maps” and then click on the buttons for Listing Windows Users and Linux Users:

Creating a map

12) Choose “Administrator” (or the appropriate account you want to map the UNIX user to) in the Windows list, and your username in the Linux list. (In Ubuntu, UIDs for user accounts usually start from 1000)

13) Click “Add” to create a map. If you get the following warning, click “OK” to ignore it.

You have specified a special Windows account.

14) Click Apply at the top right corner.

15) Now, you’re ready to share folders! Just right click any folder you need to share, and share it from the NFS tab. You can click the Permissions button for more options, like allowing write access, which is disallowed by default.

NFS Sharing on Windows.

16) Next, mount the share on your UNIX/Linux machine. I used the following command on Ubuntu:

$ sudo mount <windows-server-ip-address>:/<windows_share_name> <path_to_local_mount_point>

For example:

$ sudo mount 192.168.1.3:/SharedFolder ~/windows_share

If this guide helped you, please let us know in the comments below!

Categories
Uncategorized

Automatic Login For SSH/SFTP on Ubuntu

There are just three simple steps needed to automate your SSH/SFTP logins to remote Unix/Unix-like servers from your Ubuntu/Linux distribution, or an emulator on Windows like Cygwin.

1) Run ssh-keygen

abdullah@desktop:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/abdullah/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/abdullah/.ssh/id_rsa.
Your public key has been saved in /home/abdullah/.ssh/id_rsa.pub.
The key fingerprint is:
06:23:fc:34:0f:12:40:b2:5e:7c:41:eb:4f:a2:ab:24 abdullah@desktop
The key's randomart image is:

Randomart image

2) Run ssh-copy-id <username>@<server-name>

abdullah@desktop:~$ ssh-copy-id login@myserver.com
login@myserver.com's password: 
Now try logging into the machine, with "ssh 'login@myserver.com'", and check in:

 ~/.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

3) Login to your server using ssh

abdullah@desktop:~$ ssh 'login@myserver.com'
Welcome to MyServer.com!
Last login: Sun Sep 25 23:22:21 2011 from 209.85.175.105
login@myserver.com:~# 

That’s all!

If you want a quick shortcut in the GUI, you could add a Custom Application Launcher to the panel with the ssh login command, as shown below:

Launcher Properties

Clicking the panel icon will directly open the terminal at the server with you logged in.

Note that this will also automate the login for SFTP, so you won’t need to type in your passwords there anymore too!

Categories
Uncategorized

How to Delete a Directory in Linux

To delete or remove a directory in Linux, use the “-r” flag to the “rm” command. “r” stands for recursive.

rm -r <directory_name>

On some Linux systems, you might be prompted before each file is deleted. This means that the rm command has been aliased to “rm -i”, which turns on interactive mode. To run the original rm command and avoid the prompts, use “\rm”:

\rm -r <directory_name>

In the bash shell, just as the backslash is used to escape special characters, it is also used to escape aliases.

Caution!

Be careful to double check the directory name you provide, and be extra careful when using wildcards. There have been many stories of grief because of users ending up deleting important files and folders recursively.

Categories
Uncategorized

Flipkart – An Amazing Online Shopping Experience

Flipkart is often called the Amazon of India. Set up by two ex-Amazon employees as a startup in 2007, it brings Indians the best of the online shopping world knocking at their doors.

I’ve been a regular buyer of stuff from Flipkart, and my experience with them has been simply amazing. So here’s my review on Flipkart, and what I believe has been helping them to be highly successful.

1) They provide an estimated delivery time – and keep their promises

Flipkart does not think short term by providing overly optimistic delivery times. Online stores will ensure returning customers only if they keep their promises, and Flipkart seems to keep that in mind with their fairly accurate delivery time estimates.

The promised time of delivery varies between a few days to a couple of weeks, depending on the availability of the goods. Generally, items arrive well within the time frames.

Only once out of a dozen-odd orders I experienced a delay of ten days. I’d overlook that as an exception.

2) Dead low prices

The prices are among the lowest I could find in shops around, and Flipkart doesn’t charge for delivery. If you consider the traveling cost for going to the cheapest shops around, Flipkart will probably end up being cheaper. What attracts buyers more than the best deal in terms of money?

UPDATE (Feb 26, 2012): This no longer seems to be true. Prices have been rising, and they even delete reviews that talk about the rising prices. Flipkart explicitly warns that they may remove any pricing related comments.

3) They have their own courier services

This was a pleasant surprise to me when I first ordered from them. Flipkart uses their own courier system, to do away with the problems rampant with the infamous courier services in India.

4) Insured protection for electronic items

There have been many stories about courier delivery guys opening up packages to steal goods. Flipkart has taken the initiative to guide you upfront on this – they have insured shipping for electronic goods, so check your package when you receive it, and ask for a replacement if it’s tampered with. Hopefully, such instances won’t happen with Flipkart’s delivery service.

5) Varied options for payment – including cash on delivery

For a smoother buying experience, there are many options for payment – Credit/Debit cards, Net Banking, and Cash on Delivery in select cities. The last option is interesting – many Indian buyers are skeptical of buying items online because of the prevalence of fraud. Delivering the product home before it’s paid for is a great way to build customer confidence.

As a bookstore and a general shopping site, Flipkart seems to have a great future ahead and is already gaining a good name among the masses.

Have you ordered goods from Flipkart? Are you skeptical about online shopping in India? Feel free to comment below!