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.

Clap

Categories: Docker

Ajeet Raina

My name is Ajeet Singh Raina and I am an author of this blogging site. I am a Docker Captain, ARM Innovator & Docker Bangalore Community Leader. I bagged 2 special awards last year(2019) : Firstly, “The Tip of Captain’s Hat Award” at Dockercon 2019, San Francisco and secondly, “2019 Docker Community Award“. I was overwhelmed to receive the first award in front of around 5000 audience.

4 Comments

http://kominkikwidzinski.pl · 10th October 2016 at 9:42 pm

you’ve gotten a fantastic weblog here! would you wish to make some invite posts on my weblog?

obudowy kominkowe · 12th October 2016 at 3:38 am

Have you ever considered writing an ebook or guest authoring on other websites? I have a blog based on the same topics you discuss and would love to have you share some stories/information. I know my audience would appreciate your work. If you are even remotely interested, feel free to send me an e mail.

    ajeetraina · 12th October 2016 at 3:23 pm

    Thanks for reading this blog. I have plans to write ebook in near future. Just a matter of time.

kredyty przez internet · 23rd October 2016 at 11:00 pm

Does your blog have a contact page? I’m having trouble locating it but, I’d like to shoot you an email. I’ve got some ideas for your blog you might be interested in hearing. Either way, great site and I look forward to seeing it expand over time.

Leave a Reply

Your e-mail address will not be published. Required fields are marked *