Sunday, March 17, 2013

Getting Linux to resolve NetBIOS names

Like many others, my network consists of a mixture of Linux and Windows machines.  By default, it seems Linux doesn't not seem to resolve NetBIOS names.  After a quick Google search, this seems can be "fixed" by adding wins to the line begins with hosts: in the nsswitch.conf file found in /etc/

cd /etc/nsswitch.conf
sudo pico nsswitch.conf
locate the line that starts with host:
append the word wins to its end, e.g.

hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4 wins

save the changes, and now you should be able to ping computers on your network with their NetBIOS names.

(ref: http://www.linuxquestions.org/questions/linux-networking-3/ping-netbios-names-from-linux-samba-271336/)

edited: can use NetBIOS name with mount command too.  This is much easier to remember than using IPs of machines.

edited 2018-02-04: You may need to install winbind to get this to work.  Here is the command.

sudo apt install winbind libnss-winbind

service winbind restart



Monday, February 4, 2013

Robocopy to NAS (FFT)

robocopy is a nice command prompt utility for backup files.  You can configure it to only copy files that are newer (based on timestamp) to save time and bandwidth when you are doing backup.  However, there seems to be a problem when it is backing up files from NTFS filesystem to other filesystem, e.g. ext4, XFS etc commonly found in NAS.  It seems time granularity of time value can causes robocopy mistreats files.  That is robocopy may treat identical files as different because it thinks one of them is newer.  Luckily, this can easily be fixed by use the /FFT swtich.  Full explanations can be found at this link

http://www.conetrix.com/Blog/post/Robocopy-Incorrectly-Detects-Files-as-Newer-When-Copying-Between-Different-File-Systems.aspx

Hence, the robocopy command I would use is:

robocopy [source directory] [target directory] /MIR /Z /DCOPY:T /FFT

Sunday, January 13, 2013

cifs mounting with write permission!

I have been struggling to mount a network drive using cifs with write permission for a while. An today, I stumbled across this blog (http://microitblog.com/micro-it-blog/2011/04/21/mounting-cifs-shares-through-linux-with-write-permissions) and my problem solve!

I seems I have to pass on my user id as well as my network credential when I mount a drive. Hence, the mounting command should be:

sudo mount -t cifs //server/share /mount/point -o username="user",password="password",uid="uid#"

If you don't know your uid, you can use the id -u <username> command to find it out.

For example, if you have a network share on 10.0.0.100 (it seems IP works better than NetBIOS name) with a share called shared, then the command should be

sudo mount -t cifs //10.0.0.100/shared ~/myfolder -o username=auser,password=mypassword,uid=1000

Hope this helps.

Thursday, October 18, 2012

XAMPP phpmyadmin access forbidden

XAMPP is a great tool for web application development and testing.  It provides a self-contained environment for running web applications.

It has been a while since I have used it, and the new edition seems to have enhanced the default security.  For instance, if you run phpmyadmin on a fresh install, you will be greeted with ACCESS FORBIDDEN error.  I had anyway.  To overcome this (and my circumvents the security), I have done the below:

1) Open the /opt/lampp/etc/extra/httpd-xampp.conf with your choice of text editor
2) Update the two sections below as shown, then restart lampp.  You should be all set!

<directory lampp="lampp" opt="opt" phpmyadmin="phpmyadmin">
    AllowOverride AuthConfig Limit
Require all granted
</directory>

<LocationMatch "^/(?i:(?:xampp|licenses|phpmyadmin|webalizer|server-status|server-info))">
        Order allow,deny
        Allow from all

        ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</locationmatch>

Wednesday, October 17, 2012

Setting Environment as normal user

Just a note to myself, to edit the environment variables for a standard use, I need to type "environment" into the start menu, and use the "Edit environment variables for your account" option.

Saturday, October 13, 2012

Ainol ELF Firmware 4.0.4

One of the ongoing problems with the Ainol ELF is WiFi.  It often fails to come back when wakes up from sleep.  The only way to get the WiFi back is to restart the machine.  This is very annoying.  Few days ago, I had flashed my ELF with the latest firmware which upgraded it to 4.0.4.  It seems the WiFi problem has finally been addresses.  The new firmware behaves a lot better than the latest Essential Clean Rom (1.1a).  With the 1.1a, my tablet often has troubles to get into proper sleep mode.

One thing I miss after upgrade is the hardware volume button.  1.1a remaps the home and menu buttons to act as volume button, whereas the official one put them back to what they were before.  To make the matter even worse is that there is no soft volume button too!  So to adjust the volume, I need to go to settings -> sound to adjust the volume.  However, comparing this to the WiFi problem, I would much prefer to have the WiFi problems fixed.

Saturday, September 8, 2012

Slow transfer speed ...

As media files are getting larger and larger, it is becoming a pain to transfer files between computers over a 100Mbps network.  So I upgraded my network with a gigabit switch.  The speed has improved but is only marginally, e.g. from about 7MB/s to 12MB/s.  I have tried to look for an answer and have not had much luck till yesterday.

It seems the culprit is this thing called Large Send Offload.  Once I disable this option on my network card, the speed jumps from pathetic 12MB/s to 60-80MB/s.