Sunday, December 9, 2018

Easy Python Learning


A0 = dict(zip(('a','b','c','d','e'),(1,2,3,4,5)))
A1 = range(10)
A2 = sorted([i for i in A1 if i in A0])
A3 = sorted([A0[s] for s in A0])
A4 = [i for i in A1 if i in A3]
A5 = {i:i*i for i in A1}
A6 = [[i,i*i] for i in A1]
print(A0,A1,A2,A3,A4,A5,A6)

output :---

{'a': 1, 'e': 5, 'b': 2, 'd': 4, 'c': 3} range(0, 10) [] [1, 2, 3, 4, 5] [1, 2, 3, 4, 5] {0: 0, 1: 1, 2: 4, 3: 9, 4: 16, 5: 25, 6: 36, 7: 49, 8: 64, 9: 81} [[0, 0], [1, 1], [2, 4], [3, 9], [4, 16], [5, 25], [6, 36], [7, 49], [8, 64], [9, 81]]
 
http://www.datasciencemadesimple.com/add-spaces-in-python/ 

Friday, May 18, 2018

samba server configration with user authentication main configration file



yum install samba*

main file 

Vim /etc/samba/smb.conf

All interface in samba server who can excess samba server

interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24 192.168.122.2/24 10.0.227.2/24 192.168.100.1/24

hosts allow = 127. 192.168.12. 192.168.13. 192.168.122. 10.0.227. 192.168.100.





samba server main configration file.

[Common]
comment = All Users
path = /home/samba
writable = yes
browsable = yes
guest ok = yes
guest only = yes
create mode = 0777
directory mode = 0777

[HR]
comment = HR
    path = /home/samba/HR
 #       writeable = yes
        browsable = yes
        read only = No
    create mask = 0754
    directory mask = 0777
#    guest only = Yes
    guest ok = no
        valid users = @smbgroup hr
[Admin]
comment = Admin
        path = /home/samba/Admin
  #      [writeable = yes
        browsable = yes
        read only = No
        create mask = 0754
        directory mask = 0777
#       guest only = Yes
        guest ok = no
        valid users = @smbgroup hr admin
[User_Backup]
comment = UserBackup
        path = /home/samba/UserBackup
   #     writeable = yes
        browsable = yes
        read only = No
        create mask = 0754
        directory mask = 0777
#       guest only = Yes
        guest ok = no
        valid users = @smbgroup

[HEAD_GROUP]
comment = HEADGROUP
        path = /home/samba/HEAD_GROUP
    #    writeable = yes
        browsable = yes
        read only = No
        create mask = 0754
        directory mask = 0777
#       guest only = Yes
        guest ok = no
        valid users = @smbgroup

[IT_Department]
comment = IT Department
        path = /home/samba/IT_Department
    #    writeable = yes
        browsable = yes
        read only = No
        create mask = 0754
        directory mask = 0777
#       guest only = Yes
        guest ok = no
        valid users = @smbgroup


/etc/init.d/smbd restart
/etc/init.d/smbd start
/etc/init.d/smbd start
checkconfig smbd on
Check share all folder in samba server  


smbclient -L localhost -U%

drwxrwxrwx  6 root   root   4096 Feb  1 17:18 .
drwxr-xr-x. 9 root   root   4096 Feb  1 18:02 ..
drwxrwxr-x  2 root   admin  4096 Feb  1 17:18 Admin
drwxrwxrwx  3 nobody nobody 4096 Feb  1 16:36 bbb
drwxrwxrwx  2 nobody nobody 4096 Feb  1 17:08 dd
drwxrwxr-x  3 root   hr     4096 Feb  1 18:38 HR






Browse samba server in client side 


 smb://192.168.122.179   or smb://samba