DSR enhanced security and "formal verification" course
The "one-click" Linux C programming course
This course is completely done from my Android mobile, which, of course, is a Linux too.
It's so simple, you'll love it!
Linux Server in your browser (one-click!)
https://bellard.org/jslinux/vm.html?url=alpine-x86.cfg&mem=192
What you then will see here is a typical Unix terminal. Same as you would see after a Linux install on your computer - without the standard GNOME desktop - or after opering a Bash shell after a standard Linux installation. The only difference is, that this Linux completely runs in your browser.
localhost:~# is the alias name for the local IP address 127.0.0.1
The # in localhost:~# tells you that you are administrator, which in Unix always has the username root.
Using with / on Android phone/tablet environment
It's about saving and restoring your work and downloading examples from the internet.
Clearing your screen
Simple: localhost:~# clear ⏎
Up-/downloading files from/to Linux Server
For the course, you might want to upload some locally edited or downloaded .c files into the Linux Servern running in your browser. Or get some files out of the Linux Server to your local /download directory on your Android phone or tablet. Here's how you do it:
The hello.c file is now saved to your Android mobile or tablet. You find it in the /download directory.
From there you can upload "hello.c" again into the file system of your Linux Server:
Click on the up-arrow ⤒ in the down left corner of your Linux terminal window to upload files from local /download directory on Android mobile or tablet to continue your work.
Uploading .c file into your Linux Server
From e.g. Chuck Severance's excellent C course, download
https://github.com/csev/cc4e/blob/master/book/code/c_008_01.c
Upload c_008_01.c from your Android's /download directoy into the Linux Server by pressing the ⤒ botton left below the Linux Server terminal window.
Verify that the file c_008_01.c was uploaded:
First compile and run of a C program
It's always safe to make a copy. With the cp command you can also rename it:
Now we compile with Fabrice Bellard's own tcc C compiler:
Note: To execute the binary fahrenheit you have to put a ./ before. For security reasons your directory, where you're working in, is not included in the search path for binaries. But we can change that by adding /root to the $PATH environment variable:
Installing offline code editor
You might want to use a local editor on your Android phone / tablet to work offline:
https://play.google.com/store/apps/details?id=com.maxistar.textpad
https://f-droid.org/de/packages/com.maxistar.textpad/
Who or where am I, what rights do I have?
Let's try following Unix commands:
It sais, that you are user root (root always has admin rights!!!), user ID and group ID are zero (which always is for admin), your current directory is /root and it gives out the search path, where binaries are searched when you simply type in a command, e.g. ls
Unix standard commands
Exploring the environment
Here you see the different possibilities to show the contents of the default directory, Linux provides or has set for you directly after the login:
The directories beginning with a . are called 'hidden directories'. It's a convention in Unix. Unix is a multi user operating system. There you typically find local config files, a user can set to individually customise its binaries e.g. the browser, the mail program, editor, the graphical user interface ... It's what in Windows is called "Registry". Each user's home directory has one. You typically find them under /home.
Unix has a prototype environment setup, which gets set when a user is logging in. You find it in the file /etc/profile , which is the registry, where the setup and common environment variables for the whole Unix machine at bootup is set:
In variable PS1 the shell prompt is defined: In our case: PS1='\h:\w\$ ' which means first the hostname "localhost" comes, followed by a ":" then the working directory and then the $ prompt which indicates the normal user prompt.
Administrative commands under Unix
Adding a user in Unix
Testing the myuser account
From user root become user myuser, verify and then let's switch back:
You may have noticed that the user prompt changes from # to $ when have limited rights as user myuser ...
Changing directory in Unix
The important /bin and /sbin directories
The directories /bin and /sbin always have to be there, same as /etc and /dev.
When you accidentally may have cut off yourself by e.g. setting the environment variable PATH you will have to work with absolute pathnames, e.g. /bin/ls
Back to last lesson - https://rentry.co/DSRsecuritycoursepart6 Next lesson: https://rentry.co/DSRsecuritycoursepart8