Sign inSign up

chasim1982/samba

By chasim1982

•Updated almost 7 years ago

Samba In docker in Quick Time

Image
2

1.8K

chasim1982/samba repository overview

#Usage docker run --name SAMBA -v /home/WINDOWS:/SAMBA -p 139:139 -p 445:445 -id chasim1982/samba

user: qasim password: cba!@#$%

Watch my Videos at Youtube

https://www.youtube.com/watch?v=z5QU3eNITwI&t=53s⁠

https://www.youtube.com/watch?v=Q6-xMt7wTrM&t=148s⁠

Note: Set your desired Permissions on Directories, at your host systems

#Parameters Updates Set according to you need, Simply

docker exec -it SAMBA bash

#Edit the bash script created, to change user name & passwords or add extra users, simply copy paste and edit.

Note: vim editor is already installed

#!/bin/bash #Purpose=SAMBA Setup in quick time

USER='qasim' PASSWORD='cba!@#$%' SHARE=mkdir /SAMBA

apt update -y && apt upgrade -y && apt install -y samba && apt install -y vim

echo $SHARE

useradd $USER

(echo "$PASSWORD"; echo "$PASSWORD") | passwd $USER

groupadd smbusers

#chown -R $USER:smbusers /SAMBA

usermod -G smbusers $USER

function samba_add { (echo "$PASSWORD"; echo "$PASSWORD") | smbpasswd -s -a $USER }

⁠Calling the function

samba_add

cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

⁠To Comment a line in file with sequence (2 to 7) --> Choose your sequence

sed -i '2,7 s/^/#/' number.txt

⁠To Uncomment a line with sequence (2 to 7) --> Choose your sequence

head -n 162 /etc/filebeat/filebeat.yml | tail -n 5 | grep output.logstash | sed -ire 's/^#//' /etc/filebeat/filebeat.yml

⁠Loop

for i in cat -n number.txt | sed -re '2,7 s/^#//' number.txt`;do echo $i;done <<< $i > friends.txt

cat -n /etc/samba/smb.conf | sed -i '193,195 s/^/#/' /etc/samba/smb.conf

cat -n /etc/samba/smb.conf | sed -i '237,244 s/^/#/' /etc/samba/smb.conf

cat -n /etc/samba/smb.conf | sed -i '248,253 s/^/#/' /etc/samba/smb.conf echo echo ' [SHARE]' >> /etc/samba/smb.conf echo ' comment = samba share ' >> /etc/samba/smb.conf echo ' path = /SAMBA' >> /etc/samba/smb.conf echo ' browseable = yes ' >> /etc/samba/smb.conf echo ' guest ok = no ' >> /etc/samba/smb.conf echo ' read only = no ' >> /etc/samba/smb.conf echo ' create mask = 0755 ' >> /etc/samba/smb.conf echo " valid users = $USER " >> /etc/samba/smb.conf echo " force user = $USER " >> /etc/samba/smb.conf

#If you want test the configuration settings use mention below command just copy and paste out side inside the container do not uncomment. #testparm

#Call this function again.

samba_add

/etc/init.d/samba restart /etc/init.d/nmbd restart

#END

Dockerfile

FROM ubuntu:latest

MAINTAINER Muhammad Asim [email protected]⁠

COPY samba.sh /

RUN apt update -y && apt upgrade -y

RUN /samba.sh

CMD service samba start && bash

Tag summary

Content type

Image

Digest

Size

138 MB

Last updated

over 8 years ago

docker pull chasim1982/samba