0% found this document useful (0 votes)
120 views

Linux: 1. Naloga - Mape in Datoteke

The document describes configuring file sharing and permissions on a Linux server. It creates directories and files, adds users and groups, sets permissions on the files and directories, configures Samba to enable file sharing, and tests access from one of the user accounts. Key steps include creating a Samba share configuration, adding users to the Samba password database, and troubleshooting connection issues.
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
120 views

Linux: 1. Naloga - Mape in Datoteke

The document describes configuring file sharing and permissions on a Linux server. It creates directories and files, adds users and groups, sets permissions on the files and directories, configures Samba to enable file sharing, and tests access from one of the user accounts. Key steps include creating a Samba share configuration, adding users to the Samba password database, and troubleshooting connection issues.
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 14

LINUX

1. naloga - mape in datoteke


ado@ubuntu-server:~$ ls

ado@ubuntu-server:~$ clear

ado@ubuntu-server:~$ sudo mkdir /demoIzpit

mkdir: cannot create directory ‘/demoIzpit’: File exists

ado@ubuntu-server:~$ sudo touch /demoIzpit/demo2.txt

ado@ubuntu-server:~$ sudo touch /demoIzpit/demo2.doc

ado@ubuntu-server:~$ sudo touch /demoIzpit/demo3.doc

ado@ubuntu-server:~$ sudo mkdir /demoIzpit/demoKopija

ado@ubuntu-server:~$ sudo cp /demoIzpit/*2.doc /demoIzpit/demoKopija/

ado@ubuntu-server:~$ cd /demoIzpit/

ado@ubuntu-server:/demoIzpit$ sudo tar czvf arhiv.tgz demoKopija/

demoKopija/

demoKopija/demo2.doc

ado@ubuntu-server:/demoIzpit$ ls -lh

total 8.0K

-rw-r--r-- 1 root root 152 Jan 8 22:44 arhiv.tgz

-rw-r--r-- 1 root root 0 Jan 8 22:39 demo2.doc

-rw-r--r-- 1 root root 0 Jan 8 22:39 demo2.txt

-rw-r--r-- 1 root root 0 Jan 8 22:39 demo3.doc

drwxr-xr-x 2 root root 4.0K Jan 8 22:40 demoKopija

ado@ubuntu-server:/demoIzpit$ ls demoKopija/

demo2.doc

ado@ubuntu-server:/demoIzpit$ sudo mv demoKopija/ mapaLeva


ado@ubuntu-server:/demoIzpit$ sudo tar xzvf arhiv.tgz

demoKopija/

demoKopija/demo2.doc

ado@ubuntu-server:/demoIzpit$ sudo rm -fr mapaLeva/

ado@ubuntu-server:/demoIzpit$ ls -lh

total 8.0K

-rw-r--r-- 1 root root 152 Jan 8 22:44 arhiv.tgz

-rw-r--r-- 1 root root 0 Jan 8 22:39 demo2.doc

-rw-r--r-- 1 root root 0 Jan 8 22:39 demo2.txt

-rw-r--r-- 1 root root 0 Jan 8 22:39 demo3.doc

drwxr-xr-x 2 root root 4.0K Jan 8 22:40 demoKopija

ado@ubuntu-server:/demoIzpit$

___________________________________________________________________________

2. naloga - uporabniki in skupine


ado@ubuntu-server:/demoIzpit$ sudo useradd -m minka1

[sudo] password for ado:

ado@ubuntu-server:/demoIzpit$ sudo useradd -m minka2

ado@ubuntu-server:/demoIzpit$ sudo groupadd minkice

ado@ubuntu-server:/demoIzpit$ sudo usermod -a -G minkice minka1

ado@ubuntu-server:/demoIzpit$ sudo usermod -a -G sudo minka2

ado@ubuntu-server:/demoIzpit$

___________________________________________________________________________

3. naloga - pravice
ado@ubuntu-server:/demoIzpit$ clear

ado@ubuntu-server:/demoIzpit$ sudo chgrp -R minkice /demoIzpit/


[sudo] password for ado:

Sorry, try again.

[sudo] password for ado:

ado@ubuntu-server:/demoIzpit$ ls -lh /demoIzpit/

total 8.0K

-rw-r--r-- 1 root minkice 152 Jan 8 22:44 arhiv.tgz

-rw-r--r-- 1 root minkice 0 Jan 8 22:39 demo2.doc

-rw-r--r-- 1 root minkice 0 Jan 8 22:39 demo2.txt

-rw-r--r-- 1 root minkice 0 Jan 8 22:39 demo3.doc

drwxr-xr-x 2 root minkice 4.0K Jan 8 22:40 demoKopija

ado@ubuntu-server:/demoIzpit$ sudo chmod -R g+rw /demoIzpit/

ado@ubuntu-server:/demoIzpit$ ls -lh /demoIzpit/

total 8.0K

-rw-rw-r-- 1 root minkice 152 Jan 8 22:44 arhiv.tgz

-rw-rw-r-- 1 root minkice 0 Jan 8 22:39 demo2.doc

-rw-rw-r-- 1 root minkice 0 Jan 8 22:39 demo2.txt

-rw-rw-r-- 1 root minkice 0 Jan 8 22:39 demo3.doc

drwxrwxr-x 2 root minkice 4.0K Jan 8 22:40 demoKopija

ado@ubuntu-server:/demoIzpit$ sudo chown -R minka1 /demoIzpit/

ado@ubuntu-server:/demoIzpit$ ll /demoIzpit/

total 16

drwxrwxr-x 3 minka1 minkice 4096 Jan 8 22:46 ./

drwxr-xr-x 24 root root 4096 Jan 8 22:35 ../

-rw-rw-r-- 1 minka1 minkice 152 Jan 8 22:44 arhiv.tgz

-rw-rw-r-- 1 minka1 minkice 0 Jan 8 22:39 demo2.doc


-rw-rw-r-- 1 minka1 minkice 0 Jan 8 22:39 demo2.txt

-rw-rw-r-- 1 minka1 minkice 0 Jan 8 22:39 demo3.doc

drwxrwxr-x 2 minka1 minkice 4096 Jan 8 22:40 demoKopija/

ado@ubuntu-server:/demoIzpit$

___________________________________________________________________________

4. naloga - skupna raba


ado@ubuntu-server:/demoIzpit$ clear

ado@ubuntu-server:/demoIzpit$ sudo nano /etc/samba/smb.conf

ado@ubuntu-server:/demoIzpit$ testparm

Load smb config files from /etc/samba/smb.conf

rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)

WARNING: The "syslog" option is deprecated

Processing section "[printers]"

Processing section "[print$]"

Processing section "[SkupnaZaMinke]"

Unknown parameter encountered: "parh"

Ignoring unknown parameter "parh"

WARNING: No path in service SkupnaZaMinke - making it unavailable!

NOTE: Service SkupnaZaMinke is flagged unavailable.

Loaded services file OK.

Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

# Global parameters
[global]

dns proxy = No

log file = /var/log/samba/log.%m

map to guest = Bad User

max log size = 1000

obey pam restrictions = Yes

pam password change = Yes

panic action = /usr/share/samba/panic-action %d

passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n


*password\supdated\ssuccessfully* .

passwd program = /usr/bin/passwd %u

server role = standalone server

server string = %h server (Samba, Ubuntu)

syslog = 0

unix password sync = Yes

usershare allow guests = Yes

idmap config * : backend = tdb

[printers]

browseable = No

comment = All Printers

create mask = 0700

path = /var/spool/samba

printable = Yes
[print$]

comment = Printer Drivers

path = /var/lib/samba/printers

[SkupnaZaMinke]

available = No

read only = No

valid users = @minke

ado@ubuntu-server:/demoIzpit$ sudo service smbd restart

ado@ubuntu-server:/demoIzpit$ sudo systemctl restart smbd

ado@ubuntu-server:/demoIzpit$ sudo smbpasswd -a minka1

New SMB password:

Retype new SMB password:

Added user minka1.

ado@ubuntu-server:/demoIzpit$ sudo apt install smbclient

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following packages were automatically installed and are no longer required:

linux-headers-4.15.0-29 linux-headers-4.15.0-29-generic linux-image-4.15.0-29-generic linux-modules-


4.15.0-29-generic

linux-modules-extra-4.15.0-29-generic

Use 'sudo apt autoremove' to remove them.

The following additional packages will be installed:


libarchive13 libsmbclient

Suggested packages:

lrzip cifs-utils heimdal-clients

The following NEW packages will be installed:

libarchive13 libsmbclient smbclient

0 upgraded, 3 newly installed, 0 to remove and 99 not upgraded.

Need to get 695 kB of archives.

After this operation, 2,838 kB of additional disk space will be used.

Do you want to continue? [Y/n] y

Get:1 http://archive.ubuntu.com/ubuntu bionic-security/main amd64 libarchive13 amd64 3.2.2-


3.1ubuntu0.1 [289 kB]

Get:2 http://archive.ubuntu.com/ubuntu bionic-security/main amd64 libsmbclient amd64


2:4.7.6+dfsg~ubuntu-0ubuntu2.5 [54.3 kB]

Get:3 http://archive.ubuntu.com/ubuntu bionic-security/main amd64 smbclient amd64


2:4.7.6+dfsg~ubuntu-0ubuntu2.5 [352 kB]

Fetched 695 kB in 0s (1,950 kB/s)

Selecting previously unselected package libarchive13:amd64.

(Reading database ... 139925 files and directories currently installed.)

Preparing to unpack .../libarchive13_3.2.2-3.1ubuntu0.1_amd64.deb ...

Unpacking libarchive13:amd64 (3.2.2-3.1ubuntu0.1) ...

Selecting previously unselected package libsmbclient:amd64.

Preparing to unpack .../libsmbclient_2%3a4.7.6+dfsg~ubuntu-0ubuntu2.5_amd64.deb ...

Unpacking libsmbclient:amd64 (2:4.7.6+dfsg~ubuntu-0ubuntu2.5) ...

Selecting previously unselected package smbclient.

Preparing to unpack .../smbclient_2%3a4.7.6+dfsg~ubuntu-0ubuntu2.5_amd64.deb ...

Unpacking smbclient (2:4.7.6+dfsg~ubuntu-0ubuntu2.5) ...

Setting up libarchive13:amd64 (3.2.2-3.1ubuntu0.1) ...


Setting up libsmbclient:amd64 (2:4.7.6+dfsg~ubuntu-0ubuntu2.5) ...

Setting up smbclient (2:4.7.6+dfsg~ubuntu-0ubuntu2.5) ...

Processing triggers for libc-bin (2.27-3ubuntu1) ...

Processing triggers for man-db (2.8.3-2) ...

ado@ubuntu-server:/demoIzpit$ smbclinet -U minka1 -L //localhost/

Command 'smbclinet' not found, did you mean:

command 'smbclient' from deb smbclient

Try: sudo apt install <deb name>

ado@ubuntu-server:/demoIzpit$ smbclient -U minka1 -L //localhost/

WARNING: The "syslog" option is deprecated

Enter WORKGROUP\minka1's password:

session setup failed: NT_STATUS_LOGON_FAILURE

ado@ubuntu-server:/demoIzpit$ smbclient -U minka1 -L //localhost/

WARNING: The "syslog" option is deprecated

Enter WORKGROUP\minka1's password:

Sharename Type Comment

--------- ---- -------

print$ Disk Printer Drivers

IPC$ IPC IPC Service (ubuntu-server server (Samba, Ubuntu))

Reconnecting with SMB1 for workgroup listing.


Server Comment

--------- -------

Workgroup Master

--------- -------

WORKGROUP UBUNTU-SERVER

ado@ubuntu-server:/demoIzpit$ sudo passwd minka1

Enter new UNIX password:

Retype new UNIX password:

passwd: password updated successfully

ado@ubuntu-server:/demoIzpit$ su minka1

Password:

$ cd /demoIzpit

$ ls

arhiv.tgz demo2.doc demo2.txt demo3.doc demoKopija

$ touch test

$ ls

arhiv.tgz demo2.doc demo2.txt demo3.doc demoKopija test

$ exit

ado@ubuntu-server:/demoIzpit$ smbclient -U minka1 //localhost/SkupnaZaMinke

WARNING: The "syslog" option is deprecated

Enter WORKGROUP\minka1's password:

session setup failed: NT_STATUS_LOGON_FAILURE

ado@ubuntu-server:/demoIzpit$ smbclient -U minka1 //localhost/SkupnaZaMinke


WARNING: The "syslog" option is deprecated

Enter WORKGROUP\minka1's password:

tree connect failed: NT_STATUS_BAD_NETWORK_NAME

ado@ubuntu-server:/demoIzpit$ cat /etc/group | grep minka1

minka1:x:1001:

minkice:x:1003:minka1

ado@ubuntu-server:/demoIzpit$ sudo nano /etc/samba/smb.conf

ado@ubuntu-server:/demoIzpit$ sudo service smbd restart

ado@ubuntu-server:/demoIzpit$ smbclient -U minka1 //localhost/SkupnaZaMinke

WARNING: The "syslog" option is deprecated

Enter WORKGROUP\minka1's password:

tree connect failed: NT_STATUS_BAD_NETWORK_NAME

ado@ubuntu-server:/demoIzpit$ sudo smbpasswd -a minka2

New SMB password:

Retype new SMB password:

Mismatch - password unchanged.

Unable to get new password.

ado@ubuntu-server:/demoIzpit$ sudo smbpasswd -a minka2

New SMB password:

Retype new SMB password:

Mismatch - password unchanged.

Unable to get new password.

ado@ubuntu-server:/demoIzpit$ ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500

inet 172.17.48.137 netmask 255.255.255.240 broadcast 172.17.48.143


inet6 fe80::215:5dff:fe2c:3b0d prefixlen 64 scopeid 0x20<link>

ether 00:15:5d:2c:3b:0d txqueuelen 1000 (Ethernet)

RX packets 21224 bytes 22619005 (22.6 MB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 9974 bytes 1050585 (1.0 MB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536

inet 127.0.0.1 netmask 255.0.0.0

inet6 ::1 prefixlen 128 scopeid 0x10<host>

loop txqueuelen 1000 (Local Loopback)

RX packets 446 bytes 49732 (49.7 KB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 446 bytes 49732 (49.7 KB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

ado@ubuntu-server:/demoIzpit$ 172.17.48.137^C

ado@ubuntu-server:/demoIzpit$ sudo nano /etc/samba/smb.conf

ado@ubuntu-server:/demoIzpit$ sudo service smbd restart

ado@ubuntu-server:/demoIzpit$ smbclient -U minka1 //localhost/SkupnaZaMinke

WARNING: The "syslog" option is deprecated

Enter WORKGROUP\minka1's password:

Try "help" to get a list of possible commands.

smb: \> exit

ado@ubuntu-server:/demoIzpit$ sudo smbpasswd -a minka2


New SMB password:

Retype new SMB password:

Mismatch - password unchanged.

Unable to get new password.

ado@ubuntu-server:/demoIzpit$ sudo usermod -a -G minkice minka2

ado@ubuntu-server:/demoIzpit$ smbclient -U minka2 //localhost/SkupnaZaMinke

WARNING: The "syslog" option is deprecated

Enter WORKGROUP\minka2's password:

tree connect failed: NT_STATUS_ACCESS_DENIED

ado@ubuntu-server:/demoIzpit$ smbclient -U minka2 //localhost/SkupnaZaMinke

WARNING: The "syslog" option is deprecated

Enter WORKGROUP\minka2's password:

tree connect failed: NT_STATUS_ACCESS_DENIED

ado@ubuntu-server:/demoIzpit$ ls

arhiv.tgz demo2.doc demo2.txt demo3.doc demoKopija hecanje test

ado@ubuntu-server:/demoIzpit$ sudo mkdir /skupnoizwindows

ado@ubuntu-server:/demoIzpit$ sudo mount //172.17.48.133/SkupnaZaMinke /skupnoizwindows/ -o


username

mount: /skupnoizwindows: bad option; for several filesystems (e.g. nfs, cifs) you might need a
/sbin/mount.<type> helper program.

ado@ubuntu-server:/demoIzpit$ sudo apt install cifs-utils

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following packages were automatically installed and are no longer required:

linux-headers-4.15.0-29 linux-headers-4.15.0-29-generic linux-image-4.15.0-29-generic linux-modules-


4.15.0-29-generic
linux-modules-extra-4.15.0-29-generic

Use 'sudo apt autoremove' to remove them.

Suggested packages:

keyutils winbind

The following NEW packages will be installed:

cifs-utils

0 upgraded, 1 newly installed, 0 to remove and 99 not upgraded.

Need to get 71.5 kB of archives.

After this operation, 231 kB of additional disk space will be used.

Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 cifs-utils amd64 2:6.8-1 [71.5 kB]

Fetched 71.5 kB in 0s (361 kB/s)

Selecting previously unselected package cifs-utils.

(Reading database ... 139968 files and directories currently installed.)

Preparing to unpack .../cifs-utils_2%3a6.8-1_amd64.deb ...

Unpacking cifs-utils (2:6.8-1) ...

Setting up cifs-utils (2:6.8-1) ...

update-alternatives: using /usr/lib/x86_64-linux-gnu/cifs-utils/idmapwb.so to provide /etc/cifs-


utils/idmap-plugin (idmap-plugin) in auto mode

Processing triggers for man-db (2.8.3-2) ...

ado@ubuntu-server:/demoIzpit$ sudo mount //172.17.48.133/SkupnaZaMinke /skupnoizwindows/ -o


username

username specified with no parameter

ado@ubuntu-server:/demoIzpit$ sudo mount //172.17.48.133/SkupnaZaMinke /skupnoizwindows/ -o


username=minka1,password=Password1x

ado@ubuntu-server:/demoIzpit$ ls /skupnoizwindows/

arhiv.zip demo2.doc demo2.txt demo3.doc demoKopija

ado@ubuntu-server:/demoIzpit$ cd /skupnoizwindows/
ado@ubuntu-server:/skupnoizwindows$ ls

arhiv.zip demo2.doc demo2.txt demo3.doc demoKopija

ado@ubuntu-server:/skupnoizwindows$ su minka1

Password:

$ ll

sh: 1: ll: not found

$ ls -lh

total 512

-rwxr-xr-x 1 root root 138 Jan 8 22:30 arhiv.zip

-rwxr-xr-x 1 root root 0 Jan 8 22:09 demo2.doc

-rwxr-xr-x 1 root root 0 Jan 8 22:09 demo2.txt

-rwxr-xr-x 1 root root 0 Jan 8 22:09 demo3.doc

drwxr-xr-x 2 root root 0 Jan 8 22:33 demoKopija

$ exit

ado@ubuntu-server:/skupnoizwindows$

___________________________________________________________________________

5. naloga - particioniranje

You might also like