Skip to content

Configuring Virtual Server As File Server

Configure Virtual Server as File Server

  1. In the terminal, type startx to launch the Gnome interface

  2. Enable run level 2, 3, 4 and 5 for Samba service using chkconfig.

    chkconfig –level 2 smb on
    chkconfig –level 3 smb on
    chkconfig –level 4 smb on
    chkconfig –level 5 smb on

  3. Install samba-swat rpm that allows web-based administration of Samba service. Set swat in xinted to start automatically when server reboot. Access SWAT from http://:901. You need to login at the server with root username and password.

  4. Make sure Samba is not blocked by firewall.

  5. We setup lmhosts in all Windows machine. This is to eliminate the needs of drive mapping each time working on any web development projects from /home. We configure lmhosts as follow:

    Eg:
    192.168.0.2 fire #PRE
    #INCLUDE \\fire\general\conf\lmhosts\lmhosts

    A centalized copy of lmhosts file is maintained in server Fire.

    Format of lmhosts in Fire:
    192.168.0.2 asiapcb #PRE
    192.168.0.2 admin #PRE
    192.168.0.2 foster #PRE

    Run nbtstat –R after changes to lmhosts file

  6. Whenever you save a file as a flat text (ASCII) file from within a Windows or DOS environment, the program that you saved it with adds what is known as a carriage return at the end of every line of the file. A carriage return is a normally hidden code that indicates that the text following it should appear on the next line. Conversely, a text file created within a UNIX environment will not have a carriage return at the end of every line. Depending on the contents of the file, this may or may not pose a problem.

    Many programs in the MS Windows environment have an option to save in “Unix format.” That means they don’t insert the extra carriage returns. In Homesite > Options > Settings > File Settings > Format when saving: UNIX

  7. The following script remove all space of a filename or folder and to replace with ‘_’

    #!/usr/bin/perl -w
    # nospace /this/dir /that/dir /those/too

    use File::Find;
    use strict;
    die “usage: nospace dir[s]\n” unless @ARGV;

    my %ext;

    find(\&remspaces, @ARGV);

    sub remspaces {
    return if ($_ eq ‘.’);
    return if ($_ eq ‘..’);
    (my $new = $_) =~ tr/a-zA-Z0-9_.-/_/c;
    my $duplicate = ($new ne $_ and -e $new);
    my $try = $new;

    $ext{“$File::Find::dir/$try”}++ if $duplicate;

    while (my $count = $ext{“$File::Find::dir/$new”}++) {
    (my $with_num = $new) =~ s/(?=\.|$)/_$count/;
    $new = $with_num, last if not -e $with_num;
    }

    $ext{“$File::Find::dir/$try”}– if $duplicate;

    rename $_ => $new
    or warn “can’t rename $_ to $new: $!”;
    }

    Save the script as nospace.cgi in /etc. We set a crontab entry as follow:

    30 9 * * * /usr/bin/perl /etc/nospace.cgi /home /file

  8. All filename and folder name are automatically adjusted to lowercase by define the setting using Samba SWAT.

  9. Edit /etc/inittab and change the line id:5:initdefault: to id:3:initdefault: to boot Linux into Text mode by default, instead of X.

  10. Adding a new user on Samba file server.

    1. Add a new user
      useradd <new user> -M –g site

    2. Assign a password to new user
      smbpasswd –a <new user>

    3. Restart Samba service
      /etc/rc.d/init.d/smb restart

Categories: Lesson, Linux, Server, Solution, Web Hosting.

Comment Feed

No Responses (yet)



Some HTML is OK

or, reply to this post via trackback.