Search This Blog

Saturday, March 31, 2012

To Mount remote windows partition (windows share) under Linux


All files accessible in a Linux (and UNIX) system are arranged in one big tree, the file hierarchy, rooted at /. These files can be spread out over several devices. The mount command serves to attach the file system found on some device to the big file tree.
Use the mount command to mount remote windows partition or windows share under Linux as follows:

Procedure to mount remote windows partition (NAS share)

1) Make sure you have following information:
==> Windows username and password to access share name
==> Sharename (such as //server/share) or IP address
==> root level access on Linux
2) Login to Linux as a root user (or use su command)
3) Create the required mount point:
# mkdir -p /mnt/ntserver
4) Use the mount command as follows:
# mount -t cifs //ntserver/download -o username=vivek,password=myPassword /mnt/ntserver
Use following command if you are using Old version such as RHEL <=4 or Debian <= 3:
# mount -t smbfs -o username=vivek,password=D1W4x9sw //ntserver/download /mnt/ntserver
5) Access Windows 2003/2000/NT share using cd and ls command:
# cd /mnt/ntserver; ls -l
Where,
  • -t smbfs : File system type to be mount (outdated, use cifs)
  • -t cifs : File system type to be mount
  • -o : are options passed to mount command, in this example I had passed two options. First argument is password (vivek) and second argument is password to connect remote windows box
  • //ntserver/download : Windows 2000/NT share name
  • /mnt/ntserver Linux mount point (to access share after mounting)

Thursday, March 29, 2012

SugarCRM installation in UBUNTU

Installing SugarCRM Community Edition On Ubuntu 8.10
Version 1.0
Author: Falko Timme  
Last edited 01/07/2009
SugarCRM is a webbased CRM solution written in PHP. SugarCRM is available in different flavours called "Editions" ("Community" (free), "Professional", and "Enterprise"). For a detailed overview of the different editions, have a look at the SugarCRM website. In this tutorial I will describe the installation of the free Community Edition on Ubuntu 8.10. With the modules My PortalCalendarActivitiesContactsAccountsLeadsOpportunitiesCasesBugtrackerDocuments and Email, SugarCRM Community Edition offers everything that can be expected from a CRM solution.

1 Preliminary Note

In this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100. These settings might differ for you, so you have to replace them where appropriate.
I will install SugarCRM in Apache's default vhost (document root /var/www) in the directory /var/www/sugarcrm. you might have to adjust this on your system.
Make sure that you are logged in as root (type in
sudo su
to become root), because we must run all the steps from this tutorial as root user.

2 Install The MySQL Database Server

Install unzip to be able to unpack the SugarCRM package later:
apt-get install unzip
Install MySQL:
apt-get install mysql-server mysql-client
You will be asked the following questions:
New password for the MySQL "root" user: <-- yourrootsqlpassword (a password of your choice)
Repeat password for the MySQL "root" user: <-- yourrootsqlpassword

3 Install The Apache Webserver And PHP

apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 libapache2-mod-php5 php5-common php5-gd php5-idn php-pear php5-imap php5-mcrypt php5-mhash php5-mysql php5-sqlite php5-xmlrpc php5-xsl php5-curl
Afterwards we need to modify two settings in /etc/php5/apache2/php.ini:
vi /etc/php5/apache2/php.ini
Set the memory_limit to 64M (or more) and the upload_max_filesize to 20M:
[...]
;memory_limit = 16M      ; Maximum amount of memory a script may consume (16MB)
memory_limit = 64M
[...]
; Maximum allowed size for uploaded files.
;upload_max_filesize = 2M
upload_max_filesize = 20M
[...]
Restart Apache afterwards:
/etc/init.d/apache2 restart

4 Install SugarCRM

You can download SugarCRM Community Edition from http://www.sugarforge.org/frs/?group_id=6 or http://www.sugarcrm.com/crm/download/sugar-suite.html. Pick the latest .zip file (version 5.2.0 at the time of this wrinting) and install it as follows:
mkdir /var/www/sugarcrm
cd /tmp
wget http://www.sugarforge.org/frs/download.php/4902/SugarCE-5.2.0.zip
unzip SugarCE-5.2.0.zip
cd SugarCE-Full-5.2.0/
mv * /var/www/sugarcrm/
chown -R www-data:www-data /var/www/sugarcrm
Start the webbased SugarCRM installer by opening the URL http://server1.example.com/sugarcrm or http://192.168.0.100/sugarcrm in your browser.
The SugarCRM setup wizard comes up:

Scroll down and click on the Next button:

Accept the license (GPL) and click on Next:

Select Typical Install and click on Next:


Tuesday, March 13, 2012

What is Umask


When user create a file or directory under Linux or UNIX, she create it with a default set of permissions. In most case the system defaults may be open or relaxed for file sharing purpose. For example, if a text file has 666 permissions, it grants read and write permission to everyone. Similarly a directory with 777 permissions, grants read, write, and execute permission to everyone.

Default umask Value

The user file-creation mode mask (umask) is use to determine the file permission for newly created files. It can be used to control the default file permission for new files. It is a four-digit octal number. A umask can be set or expressed using:
  • Symbolic values
  • Octal values

Tuesday, February 28, 2012

Using Linux with no Root access SUDO!!!

Benefits of using sudo

Some benefits of leaving Root logins disabled by default include the following:
  • The Ubuntu installer has fewer questions to ask.
  • Users don't have to remember an extra password (i.e. the root password), which they are likely to forget (or write down so anyone can crack into their account easily).
  • It avoids the "I can do anything" interactive login by default (e.g. the tendency by users to login as an "Administrator" user in Microsoft Windows systems), you will be prompted for a password before major changes can happen, which should make you think about the consequences of what you are doing.
  • sudo adds a log entry of the command(s) run (in /var/log/auth.log). If you mess up, you can always go back and see what commands were run. It is also nice for auditing.
  • Every cracker trying to brute-force their way into your box will know it has an account named Root and will try that first. What they don't know is what the usernames of your other users are. Since the Root account password is locked, this attack becomes essentially meaningless, since there is no password to crack or guess in the first place.
  • Allows easy transfer for admin rights, in a short term or long term period, by adding and removing users from groups, while not compromising the Root account.
  • sudo can be setup with a much more fine-grained security policy.
  • The Root account password does not need to be shared with everybody who needs to perform some type of administrative task(s) on the system (see the previous bullet).
  • The authentication automatically expires after a short time (which can be set to as little as desired or 0); so if you walk away from the terminal after running commands as Root using sudo, you will not be leaving a Root terminal open indefinitely.

Downsides of using sudo

Although for desktops the benefits of using sudo are great, there are possible issues which need to be noted:
  • Redirecting the output of commands run with sudo requires a different approach. For instance consider sudo ls > /root/somefile will not work since it is the shell that tries to write to that file. You can use ls | sudo tee -a /root/somefile to append, or ls | sudo tee /root/somefile to overwrite contents. You could also pass the whole command to a shell process run under sudo to have the file written to with root permissions, such as sudo sh -c "ls > /root/somefile".
  • In a lot of office environments the ONLY local user on a system is Root. All other users are imported using NSS techniques such as nss-ldap. To setup a workstation, or fix it, in the case of a network failure where nss-ldap is broken, Root is required. This tends to leave the system unusable unless cracked. An extra local user, or an enabled Root password is needed here. The local user account should have its $HOME on a local disk, _not_ on NFS (or any other networked filesystem), and a .profile/.bashrc that doesn't reference any files on NFS mounts. This is usually the case for Root, but if adding a non-Root rescue account, you will have to take these precautions manually.
    • Alternatively, a sysadmin type account can be implemented as a local user on all systems, and granted proper sudo privileges. As explained in the benefits section above, commands can be easily tracked and audited.

Usage

  • When using sudo, your password is stored by default for 15 minutes. After that time, you will need to enter your password again.
  • Your password will not be shown on the screen as you type it, not even as a row of stars (******). It is being entered with each keystroke!