Seminar 0
Filesystem commands. Course infrastructure.
Tasks
Open Google Cloud Console and enter the shell session.
It is a debian-like linux. Install fenrir (see Install guides). To install autocomplete run sudo fenrir autocomplete bash.
Part 0
Fenrir ID: sem0-0
- file
-
Create a regular file
reg.reg
Solution
touch reg.reg
- dir
-
Create a directory
dir
Solution
mkdir dir
- link
-
Create a hard link
reg.linkthat points to thereg.regfile
Solution
ln reg.reg reg.link
- symlink
-
Create a symbolic link
reg.slinkthat points to thereg.regfile
Solution
ln -s reg.reg reg.slink
- pipe
-
Create two named pipes:
pipe.inandpipe.out. WriteHelloto the first one and read from the other one
Solution
mkfifo pipe.in pipe.out
-
1st terminal:
echo 'Hello' > pipe.in -
2nd terminal:
cat pipe.out -
3rd terminal:
fenrir run -i PATH
If waitpid is not found, run apt install util-linux-extra
Part 1
Fenrir ID: sem0-1
- package
-
Enter dev environment (
fenrir env up DIR). Installcolumnutility by runningapk add util-linux.
You will see this error:sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set. Find who is the owner of the/usr/bin/sudofile and change it if needed. To set the setuid bit add4prefix to the file’s octal mode.
Since you cannot usesudo, you must change the user torootand do the modifications within its session.
root's password is pass
|
Solution
$ su -
$ chown root /usr/bin/sudo
$ chmod 4755 /usr/bin/sudo
$ exit
$ sudo apk add util-linux
- file
-
Create a file
/tmp/sub/ex.txt. Its content must be:
1
2
3
4
5
Solution
Install nano and create a file.