Pages

Thursday, January 28, 2016

Reset default superuser password of PostgreSQL database

If you forgot the password of the PostgreSQL database, you can reset it by following below steps:

Start PSQL terminal with following command
$sudo -u postgres psql postgres

Then run following command and will ask to enter new password:
# \password postgres

Enter new password:
 

This method is tested with PostgreSQL 9.1.12

Wednesday, January 13, 2016

Mount Windows shared file in Linux

This post mainly focus on how to mount windows shared file in Linux.

"mount" command [1] is used to attach file systems  (located on an attached device or in network) to the file system tree at specified node.

To mount network shared file, the format of the command with most basic options as follows:

mount -t <type> //<hostname>/<shared_name> <path_to_mount_point>

type: File-system type. In this case cifs (Common Internet File System is variation of SMB protocol developed by Microsoft and native file sharing protocol used in Windows for more information refer [2])
hostname: Host name of the server (or ip address)
shared_name : Name of the shared directory/file
path_to_mount_point : path to the directory that shared file system should be mounted to file system tree

eg:
sudo mount -t cifs //10.100.5.92/TempShareDoc ~/Documents/share/ -v

If you need to mount password protected shared file, you can add those information as options username and password as follows
mount -t <type> -o username=<user_name>,password=<password> //<hostname>/<shared_name> <path_to_mount_point>

Also we can set the permissions of the mounted file system using dir_mode (directory permissions) and file_mode (directory permissions) options, as follows
mount -t <type> -o dir_mode=<permissions>,file_mode=<permissions> //<hostname>/<shared_name> <path_to_mount_point>

eg: 
sudo mount -t cifs -o dir_mode=0755,file_mode=0755  //10.100.5.92/TempShareDoc ~/Documents/share/ -v


[1] http://linux.die.net/man/8/mount
[2] https://technet.microsoft.com/en-us/library/cc939973.aspx