0% found this document useful (0 votes)
3 views8 pages

linuxpratique

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 8

1.

sudo apt update


2.sudo apt upgrade
3.loadkeys fr ou loadkeys us
4.hostnamectl
5.sudo apt install openssh-server
6.sudo systemctl status ssh
7.sudo ufw allow ssh
8.sudo nano /etc/hostname
..
serv.drhkat.cd
..
9.sudo reboot now

IP ADRESSE CONFIGURATION
########################
10.ip a / ifconfig
11.nano /etc/netplan/00-installer-config.yaml
..
network:
version: 2
ethernets:
enp0s3:
dhcp4: no
dhcp6: no
addresses: [192.168.1.1/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
..
###########script1##################################################################
############################
#!/bin/bash
sed -i -e 's/true/no/g' -e '3 a\ version: 2' -e '6d' -i -e '$a \ dhcp6: no\n addresses:
[192.168.1.10/24]\n gateway4: 192.168.1.1\n nameservers:\n addresses: [8.8.8.8,8.8.4.4]
/etc/netplan/00-installer-config.yaml
netplan apply
ip a
##################################################################################
###############################

12.sudo netplan apply


13.ip a
14.sudo nano /etc/hosts
..
192.168.1.1 serv.drhkat.cd serv
..
15.sudo nano /etc/resolv.conf
..
nameserver 192.168.1.1
..

###########################################################################
#!/bin/bash
sed -i -e '1d' /etc/hostname -i -e '3a \192.168.1.1 serv.drhkat.cd serv' /etc/hosts -i -e
's/127.0.0.53/192.168.1.1/g' /etc/resolv.conf
echo 'serv.drhkat.cd' >> /etc/hostname
###########################################################################

###############
utiliser SSH
##############

DNS CONFIGURATION
#################
16.sudo apt install bind9 bind9utils bind9-doc
17.sudo nano /etc/default/named
..
OPTIONS="-u bind -4"
..
18.sudo systemctl restart bind9
19.sudo nano /etc/bind/named.conf.options
..
acl "trusted" {
192.168.1.1;
};

options {
directory "/var/cache/bind";

recursion yes;
allow-recursion { trusted; };
listen-on { 192.168.1.1; };
allow-transfer { none; };

forwarders {

8.8.8.8;
8.8.4.4;
};

..
20.sudo nano /etc/bind/named.conf.local
..
zone "drhkat.cd" {
type primary;
file "/etc/bind/zones/db.serv.drhkat.cd";
allow-transfer { 192.168.1.1; };
};

zone "1.168.192.in-addr.arpa" {
type primary;
file "/etc/bind/zones/db.1.168.192";
allow-transfer { 192.168.1.1; };
};
..
21.sudo mkdir /etc/bind/zones
22.sudo cp /etc/bind/db.local /etc/bind/zones/db.serv.drhkat.cd
23.sudo nano /etc/bind/zones/db.serv.drhkat.cd
..
$TTL 604800
@ IN SOA serv.drhkat.cd. root.serv.drhkat.cd. (
3 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS serv.drhkat.cd.
@ IN A 192.168.1.1
serv IN A 192.168.1.1
..
24.sudo cp /etc/bind/db.127 /etc/bind/zones/db.1.168.192
25.sudo nano /etc/bind/zones/db.1.168.192
..
$TTL 604800
@ IN SOA serv.drhkat.cd. root.serv.drhkat.cd. (
3 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS serv.drhkat.cd.
@ IN PTR serv.drhkat.cd.
serv IN A 192.168.1.1
1 IN PTR serv.drhkat.cd
..

26.sudo named-checkconf
27.sudo named-checkzone serv.drhkat.cd /etc/bind/zones/db.serv.drhkat.cd
28.sudo named-checkzone 1.168.192.in-addr.arpa /etc/bind/zones/db.1.168.192
29.systemctl restart bind9
30.systemctl status bind9
31.ufw allow bind

TESTER VOS CONFIGURATION


#######################
sur le serveur
***************
ping 192.168.1.1
ping serv
ping serv.drhkat.cd

nslookup serv.drhkat.cd
sur le client
*************
windows et linux
ping serv.drhkat.cd

linux
ping serv:drhkat.cd
dig serv.drhkat.cd

CONFIGURATION DHCP
##################
32.sudo apt install isc-dhcp-server -y
##########################
/etc/default/isc-dhcp-server
INTERFACES="eth0"
##########################

33.sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.backup


34.sudo nano /etc/dhcp/dhcpd.conf
..
.
option domain-name "serv.drhkat.cd";
option domain-name-servers 192.168.1.1;

authoritative;

subnet 192.168.1.0 netmask 255.255.255.0 {


range 192.168.1.10 192.168.1.50;
option routers 192.168.1.2;
.
35.sudo systemctl start isc-dhcp-server
36.sudo systemctl status isc-dhcp-server

########verifier les configuration############


$ dhcpd -t -cf /etc/dhcp/dhcpd.conf
$ grep dhcpd /var/log/messages
#############################################

###############################
ufw allow from any to any port 53
ufw allow proto udp from 0.0.0.0/0 to 0.0.0.0/0 port 67
ufw allow proto from ::/0 to ::/0 port 1194
deny unknown-clients
###################################

TESTER VOS CONFIGURATION


#######################
sur le client windows
ipconfig /release
ipconfig /renew

ou utiliser l'interface graphique


sur le client linux
sudo dhclient -v -r eth0
sudo dhclient -v eth0

ou utiliser l'interface graphique

37.dhcp-lease-list
38.sudo nano /etc/dhcp/dhcpd.conf
..
host PC1 {
hardware ethernet 08:00:27:E4:77:F9;
fixed-address 192.168.1.20;
..
35.sudo systemctl restart isc-dhcp-server

TESTER VOS CONFIGURATION


#######################
sur le client windows
ipconfig /release
ipconfig /renew

ou utiliser l'interface graphique

sur le client linux


sudo dhclient -v -r eth0
sudo dhclient -v eth0

ou utiliser l'interface graphique

CONFIGURATION SAMBA
####################
SAMBA SANS MOT DE PASSE
***********************
36.sudo apt install samba
37.sudo mkdir /document
38.sudo chmod 777 /document
39.sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup
40.sudo nano /etc/samba/smb.conf
..
[dospart]
comment = dossier partager
path = /document
guest ok = yes
writeable = yes
browseable = yes
..
##########verifier les configurations####
testparm
#########################################
42.sudo systemctl start smbd
43.sudo systemctl status smbd
TESTER VOS CONFIGURATION
#######################
sur le client windows

W+R
\\serv.drhkat.cd\dospart
\\192.168.1.1\dospart

sur le client linux


ligne de commande

smbclient \\\\serv.drhkat.cd\\dospart
smbclient \\\\192.168.1.1\dospart

SAMBA AVEC MOT DE PASSE


***********************
44. sudo mkdir /information
45. sudo chmod 777 /information
46. sudo groupadd reseaux
47. chgr reseaux /information
48. sudo useradd kashala
49. sudo useradd kalombo
50. sudo smbpasswd -a kashala
51. sudo smbpasswd -e kashala
52. sudo smbpasswd -a kalombo
53. sudo smbpasswd -e kalombo
54. usermod -G reseaux kashala
55. usermod -G reseaux kalombo
56. sudo nano /etc/samba/smb.conf
.
..
[info]
path = /information
browseable = yes
writeable = yes
valid users = @reseaux
.
..
57. sudo systemctl restart smbd

TESTER VOS CONFIGURATION


#######################
sur le client windows

W+R
\\serv.drhkat.cd\info
\\192.168.1.1\info

sur le client linux


ligne de commande
smbclient \\\\serv.drhkat.cd\\info -U kashala
smbclient \\\\192.168.1.1\\info -U kashala

57.56. sudo nano /etc/samba/smb.conf


.
..
[info]
path = /information
browseable = yes
writeable = yes
read list = kalombo
valid users = @reseaux
.
..

58.sudo systemctl restart smbd

##########script####################################################################
#########################################################
#!/bin/bash
mkdir /admincours
chmod 777 /admincours
groupadd reseaux
chgrp reseaux /admincours
chcon -t samba_share_t /admincours
useradd -G reseaux laura
useradd -G reseaux jean
smbpasswd -a laura
smbpasswd -a jean
smbpasswd -e laura
smbpasswd -e jean\
sed -i '9 a \ map to guest = bad user' /etc/samba/smb.conf
sed -i '$a \[tmp]\ncomment= dossier tmp\npath= \/tmp\nbrowseable=yes\nwriteable=yes\nguest
ok= yes' /etc/samba/smb.conf
sed -i '$a \[admincours]\ncomment= dossier admin\npath= \/admincours\nbrowseable=
yes\nwriteable= yes\nvalid users= @reseaux\nread list= jean' /etc/samba/smb.conf
firewall-cmd --add-service=samba --zone=public --permanent
firewall-cmd --reload
systemctl start smb
systemctl enable smb
systemctl status smb
##################################################################################
#############################################################

TESTER VOS CONFIGURATION


#######################
sur le client windows

W+R
\\serv.drhkat.cd\info
sur le client linux
ligne de commande

smbclient \\\\serv.drhkat.cd\\info -U kashala


smbclient \\\\192.168.1.1\\info -U kashala

You might also like