How to setup Domain Name Server (DNS) on Linux?

It has been long I was thinking of writing something about DNS(Domain Name Server). DNS is a database of the IP to Name and Name to IP conversion.I went through lots of tutorials related to DNS but couldnt satisfy myself unless and until I started writing commands and configuring files for the initial setup.After lot of tweaking and command line I was able to setup a simple DNS server.

dns_process

Lets travel into the world of DNS.

I have a RHEL 4 Machine ready with bind packages installed.The Minimal requirement are:

[root@localhost ~]# rpm -qa bind*

bind-libs-9.2.4-24.EL4

bind-utils-9.2.4-24.EL4

bind-9.2.4-24.EL4

bind-chroot-9.2.4-24.EL4

bind-devel-9.2.4-24.EL4

bind-libs-9.2.4-24.EL4

[root@localhost ~]#

The IP Details of my Machine are:

[root@localhost ~]# ifconfig

eth0 Link encap:Ethernet HWaddr 00:16:17:C6:BE:47

inet addr:10.14.77.33 Bcast:10.14.77.127 Mask:255.255.255.128

inet6 addr: fe80::216:17ff:fec6:be47/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:36287 errors:0 dropped:0 overruns:0 frame:0

TX packets:19141 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:5408275 (5.1 MiB) TX bytes:2370680 (2.2 MiB)

Interrupt:201

lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:18714 errors:0 dropped:0 overruns:0 frame:0

TX packets:18714 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:10174891 (9.7 MiB) TX bytes:10174891 (9.7 MiB)

[root@localhost ~]#

The Exact Steps I followed are mentioned Below:

1. Open a file /etc/hosts and make it look like this:

[root@localhost ~]# cat /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1 localhost.localdomain localhost

[root@localhost ~]#

2.Edit the file /etc/resolv.conf:

[root@localhost ~]# cat /etc/resolv.conf

; generated by /sbin/dhclient-script

search tuxbuddy.raina.com

nameserver 10.14.77.33

[root@localhost ~]#

3. Run this Command:

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

BOOTPROTO=dhcp

HWADDR=00:16:17:C6:BE:47

ONBOOT=yes

TYPE=Ethernet

PEERDNS=no

[root@localhost ~]#

4. Follow this step:

[root@localhost etc]# pwd

/var/named/chroot/etc

[root@localhost etc]# vi named.conf

//

// named.conf for Red Hat caching-nameserver

//

options {

directory “/var/named”;

dump-file “/var/named/data/cache_dump.db”;

statistics-file “/var/named/data/named_stats.txt”;

/*

* If there is a firewall between you and nameservers you want

* to talk to, you might need to uncomment the query-source

* directive below. Previous versions of BIND always asked

* questions using port 53, but BIND 8.1 uses an unprivileged

* port by default.

*/

// query-source address * port 53;

};

//

// a caching only nameserver config

//

controls {

inet 127.0.0.1 allow { localhost; } keys { rndckey; };

};

zone “.” IN {

type hint;

file “named.ca”;

};

zone “tuxbuddy.raina.com” IN {

type master;

file “tuxbuddy.raina.com.zone”;

allow-update { none; };

};

zone “33.77.14.10.in-addr.arpa” IN {

type master;

file “10.14.77.33.zone”;

allow-update { none; };

};

zone “localhost” IN {

type master;

file “localhost.zone”;

allow-update { none; };

};

zone “0.0.127.in-addr.arpa” IN {

type master;

file “named.local”;

allow-update { none; };

};

zone “0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa” IN {

type master;

file “named.ip6.local”;

allow-update { none; };

};

zone “255.in-addr.arpa” IN {

type master;

file “named.broadcast”;

allow-update { none; };

};

zone “0.in-addr.arpa” IN {

type master;

file “named.zero”;

allow-update { none; };

};

include “/etc/rndc.key”;

Save the file.

5.Edit the Database Files:

[root@localhost named]# pwd

/var/named/chroot/var/named

[root@localhost named]#vi tuxbuddy.raina.com

$TTL 86400

@ IN SOA station1.tuxbuddy.raina.com. root.station1.tuxbuddy.raina.com. (

2009091100; Serial

28800 ; Refresh

14400 ; Retry

3600000 ;Expire

0 ) ; Negative

@ IN NS station1.tuxbuddy.raina.com.

@ IN A 10.14.77.33

station1.tuxbuddy.raina.com. IN A 10.14.77.33

www IN A 10.14.77.33

ftp IN A 10.14.77.33

pop IN A 10.14.77.33

www1 IN CNAME station1.tuxbuddy.raina.com.

www2 IN CNAME station2.tuxbuddy.raina.com.

www.station1.tuxbuddy.raina.com IN A 10.14.77.33

Innovation2.groupinfra.com. IN A 10.14.16.215

@ IN MX 10 station1.tuxbuddy.raina.com.

station1 IN MX 10 station1.tuxbuddy.raina.com.

~

[root@localhost named]#

6. Edit this file too:

[root@localhost named]# pwd

/var/named/chroot/var/named

[root@localhost named]#

[root@localhost named]# cat 10.14.77.33.zone

$TTL 86400

@ IN SOA station1.tuxbuddy.raina.com. root.station1.tuxbuddy.raina.com. (

4 10800 3600 604800 86400 )

IN NS station1.tuxbuddy.raina.com.

33.77.14.10.IN-ADDR.ARPA. IN PTR station1.tuxbuddy.raina.com.

[root@localhost named]#

JUST REMEMBER DONT MISS ANY . during the configuration.

DNS IS VERY SENSITIVE TO SINGLE SIGN.

Thats ALL !!!

YOUR SIMPLE DNS SERVER IS READY.

Testing the DNS SERVER

[root@localhost named]# dig -x 10.14.77.33

; <<>> DiG 9.2.4 <<>> -x 10.14.77.33

;; global options: printcmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48322 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1 ;; QUESTION SECTION: ;33.77.14.10.in-addr.arpa. IN PTR ;; ANSWER SECTION: 33.77.14.10.in-addr.arpa. 86400 IN PTR station1.tuxbuddy.raina.com. ;; AUTHORITY SECTION: 33.77.14.10.in-addr.arpa. 86400 IN NS station1.tuxbuddy.raina.com.

;; ADDITIONAL SECTION:

station1.tuxbuddy.raina.com. 86400 IN A 10.14.77.33

;; Query time: 1 msec

;; SERVER: 10.14.77.33#53(10.14.77.33)

;; WHEN: Wed Oct 7 07:28:30 2009

;; MSG SIZE rcvd: 114

[root@localhost named]#

Just See..Your IP is resolving to Hostname and vice versa.

Other Way to see if things work or not !!

[root@localhost named]# host 10.14.77.33

33.77.14.10.in-addr.arpa domain name pointer station1.tuxbuddy.raina.com.

[root@localhost named]#

These too,

[root@localhost named]# host www

www.tuxbuddy.raina.com has address 10.14.77.33

[root@localhost named]#

0
0

How to test Multicast Packet Filtering?

Today morning I started my day testing with Multicast Packet Filtering. I had buntu 12.04.1 and CentOS 6.5 in my VM running over ESX 5.5.I decided to make CentOS as Client and Ubuntu as server for the setup.

iperf-client-server
First of all, I downloaded iperf as I had no YUM working at my internal lab.
Its simple to install,download the package and install. Luckily, I dint get any dependency hell.

On Ubuntu Box:

SERVER MACHINE
=====================================

sudo iperf -s -u -B 224.0.65.68 -i 1
————————————–

server listening on UDP port 5001
Binding to local address 224.0.65.68
Joining multicast group 224.0.65.68
UDP Buffer size: 120 Kbytes(default)
——————————————

[ 3] local 224.0.65.688 port 5001 connected with 10.112.173.86 port 38577
[ 3] 0.0.-1.0 sec 128 KBytes 1.05 Mbits/sec 0.228 ms 0/ 89 (0%)

On CenTOS Box(Client):

iperf -c 224.0.65.68 -u -T 5 -t 5
———————————-
Client connecting to 224.0.65.68, UDP port 5001
sending 1470 byte datagrams
setting multicast TTL to 5
UDP buffer size: 126 KBytes(default)
——————————————
[ 3] local 10.112.173.86 port 38577 connected with 224.0.65.68 port 5001
[ 3] 0.0- 5.0 sec 642 Kbytes 1.05 Mbits/sec
[ 3] Sent 447 datagrams

1.It clearly shows that multicast address is 224.0.65.68.
e.g. server> iperf -s -u -B -i 1

This will have the iperf servers listening for datagram (-u) from the address (-B multicast address), with a periodic interval of 1s (-i 1)

2. Configure the client VM, connecting to the multicast group address and setting the TTL (-T, –ttl) as needed
e.g. client> iperf -c -u -T 5 -t 5

This will have the client connected to the multicast address (-c multicast address), with a TTL of 5 (-T 5), sending data for 5 seconds
NOTE: Use tcpdump or ethereal on server VMs to capture and analyze IP packets and ensure its validity.

Run the test for 120 sec.

That’s it..
You Have just finally tested Multicast packet Filtering.

0
0

Understanding /proc/cpuinfo

A hyperthreaded processor has the same number of function units as an older, non-hyperthreaded processor. It just has two execution contexts, so it can maybe achieve better function unit utilization by letting more than one program execute concurrently. On the other hand, if you’re running two programs which compete for the same function units, there is no advantage at all to having both running “concurrently.” When one is running, the other is necessarily waiting on the same function units.

cpu

A dual core processor literally has two times as many function units as a single-core processor, and can really run two programs concurrently, with no competition for function units.

A dual core processor is built so that both cores share the same level 2 cache. A dual processor (separate physical cpus) system differs in that each cpu will have its own level 2 cache. This may sound like an advantage, and in some situations it can be but in many cases new research and testing shows that the shared cache can be faster when the cpus are sharing the same or very similar tasks.

In general Hyperthreading is considered older technology and is no longer supported in newer cpus. Hyperthreading can provide a marginal (10%) for some server workloads like mysql, but dual core technology has essentially replaced hyperthreading in newer systems.

A dual core cpu running at 3.0Ghz should be faster then a dual cpu (separate core) system running at 3.0Ghz due to the ability to share the cache at higher bus speeds.

The examples below details how we determine what kind of cpu(s) are present.

The kernel data Linux exposes in /proc/cpuinfo will show each logical cpu with a unique processor number. A logical cpu can be a hyperthreading sibling, a shared core in a dual or quad core, or a separate physical cpu. We must look at the siblings, cpu cores and core id to tell the difference.

If the number of cores = the number of siblings for a given physical processor, then hyperthreading is OFF.

/bin/cat /proc/cpuinfo | /bin/egrep ‘processor|model name|cache size|core|sibling|physical’

Example 1: Single processor, 1 core, no Hyperthreading

processor : 0
model name : AMD Duron(tm) processor
cache size : 64 KB

Example 2: Single processor, 1 core, Hyperthreading is enabled.

Notice how we have 2 siblings, but only 1 core. The physical cpu id is the same for both: 0.

processor : 0
model name : Intel(R) Pentium(R) 4 CPU 2.80GHz
cache size : 1024 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 1
processor : 1
model name : Intel(R) Pentium(R) 4 CPU 2.80GHz
cache size : 1024 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 1

Example 3. Single socket Quad Core

Notice how each processor has its own core id. The number of siblings matches the number of cores so there are no Hyperthreading siblings. Also notice the huge l2 cache – 6 MB. That makes sense though, when considering 4 cores share that l2 cache.

processor : 0
model name : Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 4
processor : 1
model name : Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 4
processor : 2
model name : Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 2
cpu cores : 4
processor : 3
model name : Intel(R) Xeon(R) CPU E5410 @ 2.33GHz
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 3
cpu cores : 4

Example 3a. Single socket Dual Core

Again, each processor has its own core so this is a dual core system.

processor : 0
model name : Intel(R) Pentium(R) D CPU 3.00GHz
cache size : 2048 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
processor : 1
model name : Intel(R) Pentium(R) D CPU 3.00GHz
cache size : 2048 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2

Example 4. Dual Single core CPU, Hyperthreading ENABLED

This example shows that processer 0 and 2 share the same physical cpu and 1 and 3 share the same physical cpu. The number of siblings is twice the number of cores, which is another clue that this is a system with hyperthreading enabled.

processor : 0
model name : Intel(R) Xeon(TM) CPU 3.60GHz
cache size : 1024 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 1
processor : 1
model name : Intel(R) Xeon(TM) CPU 3.60GHz
cache size : 1024 KB
physical id : 3
siblings : 2
core id : 0
cpu cores : 1
processor : 2
model name : Intel(R) Xeon(TM) CPU 3.60GHz
cache size : 1024 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 1
processor : 3
model name : Intel(R) Xeon(TM) CPU 3.60GHz
cache size : 1024 KB
physical id : 3
siblings : 2
core id : 0
cpu cores : 1

Example 5. Dual CPU Dual Core No hyperthreading

Of the 5 examples this should be the most capable system processor-wise. There are a total of 4 cores; 2 cores in 2 separate socketed physical cpus. Each core shares the 4MB cache with its sibling core. The higher clock rate (3.0 Ghz vs 2.3Ghz) should offer slightly better performance than example 3.

processor : 0
model name : Intel(R) Xeon(R) CPU 5160 @ 3.00GHz
cache size : 4096 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
processor : 1
model name : Intel(R) Xeon(R) CPU 5160 @ 3.00GHz
cache size : 4096 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
processor : 2
model name : Intel(R) Xeon(R) CPU 5160 @ 3.00GHz
cache size : 4096 KB
physical id : 3
siblings : 2
core id : 0
cpu cores : 2
processor : 3
model name : Intel(R) Xeon(R) CPU 5160 @ 3.00GHz
cache size : 4096 KB
physical id : 3
siblings : 2
core id : 1
cpu cores : 2

Hope you find it useful for your interview preparation.

0
0

How to setup vsFTP server on Linux?

FTP refers to File Transfer Protocol. By default, Red Hat supports vsftp. If you do minimal RHEL installation, you mightn’t have vsftp related RPM packages installed.

ftp

To setup an anonymous ftp server on Red Hat Enterprise Linux, follow these steps:

1. Verify that the vsftpd package is installed.

#rpm -qa |grep vsftpd

If it is not installed, the install it as follows:

RHEL 3 and 4

# up2date -i vsftpd

RHEL 5
# yum install vsftpd

2. Verify the localhost line in /etc/hosts looks like the following:

127.0.0.1 localhost.localdomain localhost

3. Next configure the vsftpd.conf file. NOTE: Back up the vsftpd.conf file

# cd /etc/vsftpd
# cp vsftpd.conf ./vsftpd.conf.ORIG

Using an editor, open the file vsftpd.conf. Uncomment the line
anonymous_enable=YES. Save and quit the vsftpd.conf file.

4. Start the vsftpd service

# service vsftpd start

5. To have the vsftpd service persistent across reboot:

# chkconfig vsftpd on

6. To test the configuration run the following commands:

# ftp localhost

Login with:
username: anonymous
password: root@local

This should show an ftp prompt. Type ‘bye’ to exit to the command prompt.
NOTE: ports 20 and 21 must be opened on the firewall.

0
0

How to increae Swap space under Linux

“Can Linux be installed without swap space?”.

This question was asked to me on one of Linux System admin interview. It might confuse anyone who is still fresher and have no hands-on experience with swap terminology.But the reality is “Yes”. But if you did this, you should be ready to cope up with your Linux box next time you put extra load on your box.It will crash someday.Its always recommended to provide extra space for swap partition.Swap is only used when you have maximum load.

atemyram
This article discuss how to increase the swap space through adding swap file on Linux machine.

Lets proceed with the requisite steps to add swap file as shown below:

Lets use dd command to create swapfile. Then you need to use mkswap command to set up a Linux swap area on a device or in a file.

a) Log in as root user.

b) Run this command to create 512MB swap file (1024 * 512MB = 524288 block size):

  1. dd if=/dev/zero of=/swapf1 bs=1024 count=524288

c) Set up a Linux swap area:

  1. mkswap /swapf1

d) Activate /swapfile1 swap space immediately:

  1. swapon /swapf1

e) To activate /swapf1 after Linux system reboot, add entry to /etc/fstab file. Open this file using text editor such as vi:

  1. vi /etc/fstab

Then,append following line:

/swapf1 swap swap defaults 0 0

So next time Linux comes up after reboot, it enables the new swap file for you automatically.

Verifying if the swap is activated or not?

$ free -m

Hope the article proves useful for everyone who wants an extra swap space therein.

0
0

How to setup Centralized Logging System on Linux?

I was just hanging around blogs until I cam across one nice piece of setting up centralized Logging setup.I thought to try it out of mine and here is the output:Syslog is a fantastic facility for logging on Linux machines. Lets say you have a small number of servers, and want to log them all to one central syslog server. Here we’ll describe a simple configuration.
syslog-2
1) Setup the syslog serverOn the system you want to use as the syslog server, edit the file /etc/sysconf/syslog, and add ‘-r’ as follows:

  1. Options to syslogd
  2. -m 0 disables ‘MARK’ messages.
  3. -r enables logging from remote machines
  4. -x disables DNS lookups on messages recieved with -r
  5. See syslogd(8) for more details

SYSLOGD_OPTIONS=”-m 0 -r”

  1. Options to klogd
  2. -2 prints all kernel oops messages twice; once for klogd to decode, and
  3. once for processing with ‘ksymoops’
  4. -x disables all klogd processing of oops messages entirely
  5. See klogd(8) for more details

KLOGD_OPTIONS=”-x”

Initially I added -x because I thought it would use networked DNS. But as I am logging all from local servers, all of which are defined in /etc/hosts, it doesn’t actually go to the network for name lookup. And, having the name of the system in the log file is nice.

Now, restart syslog, and confirm that syslog is listening on port 514 (the syslog port):

root@ajeet:/root>/etc/init.d/syslog restart
Shutting down kernel logger: [ OK ]
Shutting down system logger: [ OK ]
Starting system logger: [ OK ]
Starting kernel logger: [ OK ]
root@ajeet:/root>netstat -an|grep 514
udp 0 0 0.0.0.0:514 0.0.0.0:*

2) Now, configure your client:

For simplicity, I added a line in the /etc/hosts file to add the name ‘loghost’ to the other names I am using for my logging server. This is actually beneficial – because I can move my syslog server to another host – and I only have to modify the hosts file…

Next, edit the /etc/syslog.conf file. I added 1 simple line to log all informational messages to the remote loghost:

*.info @loghost

Note: separate all columns with the tab character, not space.

Finally restart syslog on the client with /etc/init.d/syslog restart.

To test, you can use the command line logging facility called logger. On the client I type:

root@tuxbuddy:/etc>logger foobar

And on the server I see:

root@ajeet:/root>tail -f /var/log/messages

Jun 28 21:17:29 tubxuddy bemo: fooba

Hence, the centralized logging server is Ready !!!

0
0

How to create password-less SSH for Linux

Sometimes you might need setting up Password-less SSH for running script or for application where you dont want to use password everytime. Here is a quick method to setup password-less SSH.

SSH_Dock_Icon_by_eternicode

Lab Scenerio:

Machine1: 192.168.160.194

Machine2: 192.168.160.197

a. Run this command on Machine1:

#ssh-keygen -t rsa

It will show you this output. Just press Enter throughout the queries asked.

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /root/.ssh/id_rsa.

Your public key has been saved in /root/.ssh/id_rsa.pub.

The key fingerprint is:

40:f0:87:19:23:47:1e:ef:65:7b:5d:05:b0:fa:48:81 root@puppet-server.test.com

The key’s randomart image is:

+–[ RSA 2048]—-+

| ooB …..|

| * B . . .|

| * E + . .|

| + o + . . |

| S + . . |

| . + |

| . . |

| |

| |

+—————–+

b. Let’s copy the key to remote Machine2:

#ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.160.197

root@192.168.160.197’s password:

It will show you the following output.

Now try logging into the machine, with “ssh ‘root@192.168.160.197′”, and check in:

.ssh/authorized_keys

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

c. Now passwordless SSH is ready. Just test by typing this:

#ssh 192.168.160.197

0
0

Installing SMARTFOX Server Pro on Debian

SmartFoxServer is a massive multiplayer platform for building games, MMO communities, virtual worlds, realtime multiplayer games.

smartfox-10

To setup SFS, in short on Linux platform like Debian, one can follow the below steps:

Download the SmartFox Server Pro 1.6.6 fromhttp://smartfoxserver.com/download/get/77/SFSPRO_linux64_1.6.6.tar.gz link.

smart-2

1. Open a terminal window and move to the folder where you have downloaded the file.
2. Type “gzip -d filename.tar.gz” to extract the .tar file (where “filename” is the name of the downloaded file) as shown in the screenshot.
3. Type “tar xf filename.tar” to extract the files.
4. Move inside the uncompressed folder and type ./install

smart-3

smart-4

To start the server move to the {installation-directory}/SFS_PRO_1.6.6/Server folder and type ./sfs start

smart-5

The complete list of commands is the following:

./sfs start Start the server
./sfs stop Stop the server
./sfs restart Restart the server
./sfs status Show the current status of the server ( running / not running etc… )

Installing SmartFoxServer as a Linux daemon:

smart-6

Hope it helps !!!

0
0

Setting up a Simple Samba Share – Part II

In the previous article we saw the practical implication of setting up a samba share.In this article we will explore more about the Samba with practical approach.

samba-2

Aim:

Connnecting to Samba Server through Own Client Software on the same machine

Implementation:

[root@rhel samba]# smbclient //localhost/ -U jen
Password:
Domain=[rhel] OS=[Unix] Server=[Samba 3.0.25b-0.4E.6]
tree connect failed: NT_STATUS_BAD_NETWORK_NAME
[root@rhel samba]# smbclient //localhost/jen -U jen
Password:
Domain=[rhel] OS=[Unix] Server=[Samba 3.0.25b-0.4E.6]
smb: \>
You will see lots of commands here:

smb: \> ?
? altname archive blocksize cancel
case_sensitive cd chmod chown close
del dir du exit get
getfacl hardlink help history lcd
link lock lowercase ls mask
md mget mkdir more mput
newer open posix posix_open posix_mkdir
posix_rmdir posix_unlink print prompt put
pwd q queue quit rd
recurse reget rename reput rm
rmdir showacls setmode stat symlink
tar tarmode translate unlock volume
vuid wdel logon listconnect showconnect
!

smb: \>

Example:

Lets put a file called text1 from the share to a directory /tmp
Here it goes:

[root@rhel samba]# cd /home/jen/
[root@rhel jen]# ls
[root@rhel jen]# touch text <<—– Lets Create a file called text1 [root@rhel jen]# vi text [root@rhel jen]# smbclient //localhost/jen -U jen Password: Domain=[rhel] OS=[Unix] Server=[Samba 3.0.25b-0.4E.6] smb: \> ls
. D 0 Mon Aug 3 17:16:20 2009
.. D 0 Mon Aug 3 17:02:24 2009
.bash_logout H 24 Mon Aug 3 17:02:24 2009
.kde DH 0 Mon Aug 3 17:02:24 2009
.gtkrc H 120 Mon Aug 3 17:02:24 2009
.bash_profile H 191 Mon Aug 3 17:02:24 2009
text 6 Mon Aug 3 17:16:20 2009 <<— Here is a file .bashrc H 124 Mon Aug 3 17:02:24 2009 50521 blocks of size 262144. 27714 blocks available smb: \>

Remember currently we are now in /tmp directory:

[root@rhel jen]# cd /tmp
[root@rhel tmp]# smbclient //localhost/jen -U jen
Password:
Domain=[rhel] OS=[Unix] Server=[Samba 3.0.25b-0.4E.6]
smb: \> ls
. D 0 Mon Aug 3 17:16:20 2009
.. D 0 Mon Aug 3 17:02:24 2009
.bash_logout H 24 Mon Aug 3 17:02:24 2009
.kde DH 0 Mon Aug 3 17:02:24 2009
.gtkrc H 120 Mon Aug 3 17:02:24 2009
.bash_profile H 191 Mon Aug 3 17:02:24 2009
text 6 Mon Aug 3 17:16:20 2009
.bashrc H 124 Mon Aug 3 17:02:24 2009

50521 blocks of size 262144. 27714 blocks available
smb: \> get text
getting file \text of size 6 as text (60000.0 kb/s) (average inf kb/s)
smb: \>

Now, When I browse /tmp directory i can see:

[root@rhel tmp]# ls
mapping-root text
[root@rhel tmp]#

Aim:

Seting up a Samba Server which avails documents and printer to only the system regular users and not to anyone outside.

Implementation:

1. Share Point ==> /export
2. All files owned by user called Ajeet Raina

Lets create a user :

[root@rhel tmp]# useradd -c “Ajeet Raina” -m -g users -p Oracle9ias ajeetr
[root@rhel tmp]# mkdir /export
[root@rhel tmp]# chmod u+rw,g+rw,o+rw /export
[root@rhel tmp]# chown ajeetr.users /export
[root@rhel tmp]#

Copy the files that should be shared to the /export directory.

0
0

Setting up a Simple Samba Share – Part I

Samba is an important component to seamlessly integrate Linux/Unix Servers and Desktops into Active Directory environments using the winbind daemon.In simple words, Samba is the standard Windows interoperability suite of programs for Linux and Unix.Since long back in 1992, Samba has provided secure, stable and fast file and print services for all clients using the SMB/CIFS protocol, such as all versions of DOS and Windows, OS/2, Linux and many others.

Samba

Today we are going to setup a simple samba share.

Setting Up a Simple Samba Share which can be accessed by anyone who has account on the Machine.

Backup the smb.conf file
——————————————

Locating the Correct Samba configuration File:

[root@rhel samba]# smbd -b | grep smb.conf
CONFIGFILE: /etc/samba/smb.conf
[root@rhel samba]#

[root@rhel ~]# cd /etc/samba/
[root@rhel samba]# cp smb.conf smb.conf.orig
[root@rhel samba]# > smb.conf
[root@rhel samba]# vi smb.conf

Add a simple Homes Share in smb.conf
——————————————————

[root@rhel samba]# cat smb.conf

[global]
workgroup = MIDEARTH
[homes]
guest ok = no
read only = no

[root@rhel samba]#

[root@rhel samba]# service smb restart
Shutting down SMB services: [FAILED]
Shutting down NMB services: [FAILED]
Starting SMB services: [ OK ]
Starting NMB services: [ OK ]
[root@rhel samba]#

Add a user called Jen
—————————–

[root@rhel samba]# useradd jen
[root@rhel samba]# passwd jen
Changing password for user jen.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

Provide him with smb credentials(this is different from normal user/pass credentials)

[root@rhel samba]# smbpasswd -a jen
New SMB password:
Retype new SMB password:
Added user jen.
[root@rhel samba]#

Go to Start > Run > \\MachineIP
Login in through user/pass
Successfull !!!

You can see home directory [homes] and jen own home directory

Testing Your Samba Share
————————-

[root@rhel samba]# testparm /etc/samba/smb.conf
Load smb config files from /etc/samba/smb.conf
Processing section “[homes]”
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
workgroup = MIDEARTH

[homes]
read only = No
[root@rhel samba]#

List Shares Available on the Server
———————————————–

[root@rhel samba]# smbclient -L rhel -U jen
Password:
Domain=[rhel] OS=[Unix] Server=[Samba 3.0.25b-0.4E.6]

Sharename Type Comment
——— —- ——-
homes Disk
IPC$ IPC IPC Service (Samba 3.0.25b-0.4E.6)
jen Disk Home directory of jen
Domain=[rhel] OS=[Unix] Server=[Samba 3.0.25b-0.4E.6]

Server Comment
——— ——-

Workgroup Master
——— ——-
MIDEARTH BL07DL380G5

Done. Your first samba share is Ready !!!

0
0