Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • asztrikx/linux-presentation
  • zoli0/linux-presentation
2 results
Show changes
Commits on Source (104)
image: kroniak/ssh-client
# image: kroniak/ssh-client
stages:
- generate
- build
- deploy
home:
variables:
CI_REGISTRY_IMAGE: ${CI_REGISTRY}/${CI_PROJECT_NAME}
KUBECONFIG_VAR_NAME: KUBECONFIG
# home:
# stage: deploy
# before_script:
# - eval $(ssh-agent -s)
# - echo "$SSH" | tr -d '\r' | ssh-add -
# - mkdir -p ~/.ssh/socket
# - chmod 700 ~/.ssh
# - cp .magic_ssh_config ~/.ssh/config
# script:
# # AFS magic incoming
# - ssh mikewashere@centaur.sch.bme.hu cp /afs/sch.bme.hu/home/mikewashere/.system/mikewashere.keytab /tmp/mikewashere.keytab
# - ssh mikewashere@centaur.sch.bme.hu kinit -k -t /tmp/mikewashere.keytab mikewashere
# - ssh mikewashere@centaur.sch.bme.hu rm /tmp/mikewashere.keytab
# - ssh mikewashere@centaur.sch.bme.hu aklog sch.bme.hu -k SCH.BME.HU
# - ssh mikewashere@centaur.sch.bme.hu mkdir -p /home/mikewashere/public_html/linux
# # actual work
# - scp -r $PWD/* mikewashere@centaur.sch.bme.hu:/home/mikewashere/public_html/linux/
# - ssh mikewashere@centaur.sch.bme.hu env sh -c 'echo lolwut; cd public_html/linux; bash cirun.sh'
# only:
# refs:
# - master
gen_pres:
stage: generate
image:
name: marpteam/marp-cli
entrypoint: [""]
script:
- alias marp="node /home/marp/.cli/marp-cli.js"
- cd eloadas
- marp -o index.html presentation.md
artifacts:
paths:
- eloadas/index.html
container:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
before_script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n ${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD} | base64)\"}}}" > /kaniko/.docker/config.json
script:
- |
/kaniko/executor --context ${CI_PROJECT_DIR} \
--dockerfile ${CI_PROJECT_DIR}/Dockerfile \
--destination ${CI_REGISTRY_IMAGE}:latest
only:
- master
except:
- tags
kubernetes:
stage: deploy
image:
name: harbor.sch.bme.hu/kszk/kube-tools:latest
entrypoint: [""]
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh/socket
- chmod 700 ~/.ssh
- cp .magic_ssh_config ~/.ssh/config
- chmod 600 ${!KUBECONFIG_VAR_NAME}
- export KUBECONFIG=${!KUBECONFIG_VAR_NAME}
script:
# AFS magic incoming
- ssh mikewashere@centaur.sch.bme.hu cp /afs/sch.bme.hu/home/mikewashere/.system/mikewashere.keytab /tmp/
- ssh mikewashere@centaur.sch.bme.hu kinit -k -t /tmp/mikewashere.keytab mikewashere
- ssh mikewashere@centaur.sch.bme.hu rm /tmp/mikewashere.keytab
- ssh mikewashere@centaur.sch.bme.hu aklog sch.bme.hu -k SCH.BME.HU
- ssh mikewashere@centaur.sch.bme.hu mkdir -p ~/public_html/linux
- ls ~/.ssh/socket
# actual work
- scp -R . mikewashere@centaur.sch.bme.hu:~/public_html/linux/.
- kubectl rollout restart deployment linux-presentation
only:
refs:
- master
\ No newline at end of file
- master
except:
- tags
......@@ -2,4 +2,7 @@ Host centaur.sch.bme.hu
StrictHostKeyChecking no
ControlMaster auto
ControlPersist yes
ControlPath ~/.ssh/socket/%r@%h:%p
\ No newline at end of file
ControlPath ~/.ssh/socket/%r@%h:%p
KexAlgorithms +diffie-hellman-group1-sha1
Ciphers +3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr
HostKeyAlgorithms +ssh-rsa
FROM nginx:1.21.6
COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY . /usr/share/nginx/html
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Linux presentation
Copyright (C) 2021 Miklós Tóth
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.
# Hello world
\ No newline at end of file
# Üdv a Linuxos előadás segédletében
<p id="meme"></p>
## Kedvcsináló
<script>
if (
navigator.platform.indexOf("Linux") !== -1 &&
!(navigator.userAgent.indexOf("Android") !== -1)
) {
document.getElementById('meme').innerText = "And oh, btw, hello fellow Linux user!";
}
</script>
*Miért is jó nekem, ha tudok Linuxul?*
- A világ legelterjedtebb\* operációs rendszerét tudni fogod használni.
- Az interneten lévő szerverek [túlnyomó többsége](https://en.wikipedia.org/wiki/Usage_share_of_operating_systems#Public_servers_on_the_Internet) Linuxot használ
- Az Android is Linux alapú, így a telefonok [>70%-án](https://en.wikipedia.org/wiki/Usage_share_of_operating_systems#Mobile_devices) Linux fut
- A [top 500](https://en.wikipedia.org/wiki/Usage_share_of_operating_systems#Supercomputers) szuperszámítógép mind Linuxot futtat
- Mindenféle beágyazott cuccban megtalálható a Linux (autók, random gépek, stb)
- Sok itt megtanult tudást más operációs rendszereken is tudod hasznosítani
- A legtöbb nem Windows alapú OS UNIX-szerű<sup>(erről később lesz szó)</sup>, csakúgy mint a Linux,
így az előadásaink nagy része ugyanígy vonatkozik macOS-re és BSD-kre is
- A KSZK-s szolgáltatások többsége is Linuxon fut,
így szükséged lesz egy kis Linux tudásra akkor is, ha a DevTeam-ben
vagy HaT-ban szeretnél ügyeskedni, nem beszélve a SysAdmin-ról, NETeam-ről vagy SecurITeam-ről
*OK, meggyőztél. Miről is lesz szó?*
- UNIX-os dolgokról
- Terminálról, shellről
- A Linux alapvető felépítéséről
- Pár fontosabb parancsról
- Egy (web)szerver üzemeltetéséhez szükséges tudásról
## Jegyzet
- [Linux alapok](linux%20alapok.md)
- [Szerver kezelés](szerver%20kezelés.md)

,,╓╖æææφφæææ╖╖,,
,φΦ▓╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫▓Φæ┐
╓Φ▓╫╫╫╫╫╫╫╫▓╣╝╝╝╜╜╜╜╜╝╝╣▓╫╫╫╫╫╫╫╫╫Φ╖
,╖▓╫╫╫╫╫╫▌╜"` `"╜╣╫╫╫╫╫╫▓╗,
╓╣╫╫╫╫╫▌╜` `╙╣╫╫╫╫╫▓╖
╔▓╫╫╫╫▌┘ ╙╣╫╫╫╫╫╗
╓▓╫╫╫╫Å` `╝╫╫╫╫╫φ
,╣╫╫╫╫▀ ╝╫╫╫╫▓
╓╫╫╫╫▓^ `╣╫╫╫╫w
╓╫╫╫╫▌ ║╫╫╫╫N
╓╫╫╫╫▌ ╓╫╫▌ Φ▓Φ ║╫╫╫╫φ
.╫╫╫╫▌ ╫╫▓ ╣╫╫M ║╫╫╫╫∩
╣╫╫╫╫ ╢╫╫ ╓╫╫▌ ╫╫╫╫▓
.╫╫╫╫▀ ╓╫╫╛ .╫╫▓ ║╫╫╫╫L
║╫╫╫╫ ▓╫▌ ║╫╫╫@ ,,, ╣╫╫ ╫╫╫╫▌
╣╫╫╫╫ ╢╫╫ ,╖æ .╫╫╫▌ ,╗╣▓╫╫╫╫╫╫╫╡║╫╫Ñ ,ææ ╫╫╫╫╫
╣╫╫╫╫ ┌╫╫Γ,æ▓╫╝ ╣╫╫▓ '╝╝╝╜╢╫╫╫╫M,╫╫╫ ,φ▓╫▓┘ ╫╫╫╫╫
║╫╫╫╫ ▓╫╫▓╫╣╜ ╓╫╫╫╡ ╓╣╫╫╫▀ ▓╫╫▌╣╫╫▓┘ ╫╫╫╫▌
╘╫╫╫╫L ║╫╫╫╫╜ ,╫╫╫╫▓ ╓▓╫╫╫Å ║╫╫╫╫╫▌` ╣╫╫╫╫
╫╫╫╫▓ .╫╫╫╫╫φ ,▓╫▀╫╫╫φ ╗▓╫╫╫╝ ┌╫╫╫╫╫╫┐ ╓▓╫╫╫╫┘
╘╫╫╫╫φ ╣╫╫╛╚╫╫W,╓╬╫╫▓ ║╫╫╫ ╓▓╫╫╫▓╖╗╖┐ ▓╫╫▌║╫╫╫µ ,,,╖╗╣╫╫╫╫╫▌
╢╫╫╫╫┐ ┌╫╫M ╚▓╫╫╫▓╫╫╫╣╫╫▓ ╫╫╫╫╫╫╫╫╫▓┘║╫╫▌ ╣╫╫╫╫╫╫╫╫╫╫╫╫▓╜
╣╫╫╫╫┐ '╝` ╙╝╣╣╝ `╙╜╙"^` ╣╫▌ ╙╣╫╫╫╫▓▀╝╜`
╣╫╫╫╫W
╚╫╫╫╫▓,
`╣╫╫╫╫Φ,
╙▓╫╫╫╫▓w ┌╣▓╖
╙╣╫╫╫╫╫Φ, ,#▓╫╫╫╫▓
`╝╫╫╫╫╫╫▓╗, ,╖╣╫╫╫╫╫╫Å`
`╝▓╫╫╫╫╫╫╫▓φ╗╖,, ,,╓╖φ╣╫╫╫╫╫╫╫▓╝`
"╜╣╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫╫▓╝"
`╙╜╝╣▓╫╫╫╫╫╫╫╫╫╫▓╣╝╜╙`

This diff is collapsed.
#!/bin/bash
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
#echo "Not yet 😉" > "második videó.md"
echo "Lorem Ipsum is simply dummy text of the printing and typesetting industry."
fi
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="generator" content="pandoc">
<meta name="author" content="Tóth Miklós">
<meta name="dcterms.date" content="2021-03-21">
<title>Linux előadás</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="https://unpkg.com/reveal.js@^4//dist/reset.css">
<link rel="stylesheet" href="https://unpkg.com/reveal.js@^4//dist/reveal.css">
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
</style>
<link rel="stylesheet" href="https://unpkg.com/reveal.js@^4//dist/theme/black.css" id="theme">
</head>
<body>
<div class="reveal">
<div class="slides">
<section id="title-slide">
<h1 class="title">Linux előadás</h1>
<p class="author">Tóth Miklós</p>
<p class="date">March 21, 2021</p>
</section>
<section id="pár-egyéb-hasznos-parancs" class="slide level1">
<h1>Pár egyéb hasznos parancs</h1>
</section>
<section id="wc" class="slide level1">
<h1><code>wc</code></h1>
<ul>
<li>word counter</li>
<li>szavak, sorok számolása</li>
</ul>
<pre class="shell-session"><code>[mike@thinkyboi ~]$ echo &quot;egy két há&quot; | wc -w
3
[mike@thinkyboi ~]$ echo &quot;egy két há&quot; | wc -l
1
[mike@thinkyboi ~]$ echo &quot;egy
két
&quot; | wc -l
3</code></pre>
</section>
<section id="tr" class="slide level1">
<h1><code>tr</code></h1>
<ul>
<li>karaktereket cserél ki vagy töröl</li>
</ul>
<pre class="shell-session"><code>[mike@thinkyboi ~]$ echo &quot;almafa&quot; | tr &quot;a&quot; &quot;e&quot;
elmefe
[mike@thinkyboi ~]$ echo &quot;almafa körtefa eperfa&quot; | tr &quot; &quot; &quot;\n&quot;
almafa
körtefa
eperfa
[mike@thinkyboi ~]$ echo &quot;almafa&quot; | tr -d &quot;a&quot;
lmf</code></pre>
</section>
<section id="curl" class="slide level1">
<h1><code>curl</code></h1>
<ul>
<li>http shellből</li>
<li>stdout-ra írja ki, kivéve, ha van <code>-o</code> kapcsoló</li>
</ul>
<pre class="shell-session"><code>[mike@thinkyboi ~]$ curl https://home.sch.bme.hu/~mikewashere/linux/eloadas.md | grep stdout
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 777 100 777 0 0 33782 0 --:--:-- --:--:-- --:--:-- 33782
- stdout-ra írja ki
[mike@thinkyboi ~]$ curl https://home.sch.bme.hu/~mikewashere/linux/eloadas.md -o eloadas.md
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 777 100 777 0 0 31080 0 --:--:-- --:--:-- --:--:-- 31080
[mike@thinkyboi ~]$ </code></pre>
</section>
<section id="sh-fileok" class="slide level1">
<h1><code>.sh</code> fileok</h1>
<ul>
<li>shell automatizálása</li>
<li>mintha soronként kiadnánk a parancsokat</li>
</ul>
</section>
<section id="egy-.sh-file" class="slide level1">
<h1>egy <code>.sh</code> file</h1>
<pre class="shell-session"><code>[mike@thinkyboi tmp]$ vi test.sh
[mike@thinkyboi tmp]$ cat test.sh
echo &quot;ez simán működik&quot; | cowsay
curl &quot;https://home.sch.bme.hu/~mikewashere/linux/eloadas.md&quot; | grep &quot;soronként&quot; | cowsay
[mike@thinkyboi tmp]$ bash test.sh
_____________________
&lt; ez simán működik &gt;
---------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1596 100 1596 0 0 69391 0 --:--:-- --:--:-- --:--:-- 69391
_________________________________
/ - mintha soronként kiadnánk a \
\ parancsokat /
---------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
[mike@thinkyboi tmp]$ </code></pre>
</section>
<section id="shebang" class="slide level1">
<h1>shebang</h1>
<ul>
<li>file futtatásakor a kernel meglesi mi van az elején</li>
<li>el tudunk indítani scripteket programként</li>
<li><code>#!&lt;program&gt;</code></li>
</ul>
</section>
<section id="shebang-1" class="slide level1">
<h1>shebang</h1>
<pre class="shell-session"><code>[mike@thinkyboi tmp]$ vi test.sh
[mike@thinkyboi tmp]$ cat test.sh
#!/bin/bash
echo &quot;ez simán működik&quot; | cowsay
curl &quot;https://home.sch.bme.hu/~mikewashere/linux/eloadas.md&quot; | grep &quot;soronként&quot; | cowsay
[mike@thinkyboi tmp]$ chmod +x test.sh
[mike@thinkyboi tmp]$ ./test.sh
_____________________
&lt; ez simán működik &gt;
---------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1596 100 1596 0 0 11319 0 --:--:-- --:--:-- --:--:-- 11319
_________________________________
/ - mintha soronként kiadnánk a \
\ parancsokat /
---------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
[mike@thinkyboi tmp]$ </code></pre>
</section>
<section id="tűzfal" class="slide level1">
<h1>tűzfal</h1>
<ul>
<li>a kernel belsejében -&gt; gyors, de low-level</li>
<li>iptables</li>
<li>kényelmesebb egy tűzfal-kezelő</li>
</ul>
</section>
<section id="ufw" class="slide level1">
<h1>UFW</h1>
<ul>
<li>uncomplicated firewall</li>
<li>egyszerű</li>
</ul>
<pre class="shell-session"><code>[mike@thinkyboi tmp]$ sudo ufw allow 80
Rules updated
Rules updated (v6)
[mike@thinkyboi tmp]$ sudo ufw allow https
Rules updated
Rules updated (v6)
[mike@thinkyboi tmp]$ sudo ufw enable</code></pre>
</section>
<section id="ssh-kulcsok" class="slide level1">
<h1>SSH kulcsok</h1>
<ul>
<li>biztonságosabb, mint egy jelszó</li>
<li>sok algoritmus, RSA, elliptikus görbék</li>
<li>publikus-privát</li>
<li>privát saját gépen, védve</li>
<li>publikus ott, ahova belépnénk</li>
<li><code>~/.ssh/authorized_keys</code></li>
</ul>
</section>
<section id="generálás" class="slide level1">
<h1>Generálás</h1>
<pre class="shell-session"><code>mike@thinkyboi:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/mike/.ssh/id_rsa):
Created directory &#39;/home/mike/.ssh&#39;.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/mike/.ssh/id_rsa
Your public key has been saved in /home/mike/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:tYZX08XEZfJP5j/um2Y9KUgG+jffe82ONwgzkt4p0hc mike@thinkyboi
The key&#39;s randomart image is:
+---[RSA 3072]----+
| .+*|
| . =o|
| . o . +|
| + o . +.|
| S * o|
| . = E .|
| + = B .o=|
| . = B ooBO|
| . + o.*XB|
+----[SHA256]-----+
mike@thinkyboi:~$ cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDjAZMAbpNutuc/ZgHWMcjWcPQOC0d8+JrDaHMnxZfRtfdyrgZDfPmMER95148JVEfkjjhur8a+IEfQM59o+yq95+yNvJFT6Nr5JzHK8dC5IuDvvEVNrKPwmW4UIgm1e5b95pGivJ5cnoiXevtp87seaxh0DlZFONKUeIFnwyDBUII7mRyXDn7MrFlAcxXtlZnSSCXXLGUMZI7nldiyRI9gXlZYCpfA8XrXrnM6JAIA+6VozhJurAKhygV6rH5yD4Vg+/Bs+wigywE3U79gbqpPzRegmxzKdgv+NNKV900DQVYNzvCU5o6q9d2amU+CDSw6KjU+4SLFOgZ3myXCyE9er3aaROj22sQdPwv8CnwtZstRibpp2SU627J4Vr7caPl8wrZcGvmXgD50mPh9Kdd+Yr5WJFSaAcog082aWBdrB3Qr9LM5DgcWulyDmUMmjA2WWCJN+t6vDT5d+2mYeBiZ2OY5ZkHyUjD6GVGBOZP/lP9EAxi3XwoM3V8TwoEgLD8= mike@thinkyboi
mike@thinkyboi:~$ </code></pre>
</section>
<section id="operátor" class="slide level1">
<h1><code>&gt;&gt;</code> operátor</h1>
<ul>
<li><code>&gt;</code> tesója</li>
<li>filehoz appendál</li>
</ul>
<pre class="shell"><code>curl https://git.sch.bme.hu/mikewashere.keys &gt;&gt; ~/.ssh/authorized_keys</code></pre>
</section>
<section id="házi-feladatok" class="slide level1">
<h1>Házi Feladatok</h1>
</section>
<section id="alap-házi" class="slide level1">
<h1>Alap házi</h1>
<p>Csinálj felhasználót a csapattársaidnak a VM-edre úgy, hogy hozzáférjenek a statikus weboldalak mappájához, ezután próbáljátok ki, hogy valóban hozzáfértek-e és ha igen, rakjatok valami funky html-t a mappába ajándékba a társaitoknak.</p>
<p>Hint: adduser/useradd, usermod/gpasswd, chmod.</p>
</section>
<section id="side-quest" class="slide level1">
<h1>Side Quest</h1>
<p>Állíts be kulcsos hitelesítést a képzés VM-eden az SSH kapcsolatodhoz. Ehhez szükséged lesz egy privát és egy publikus kulcsra a kliensgépeden.</p>
<p>Hint: ssh-keygen.</p>
</section>
<section id="expert-sudo" class="slide level1">
<h1>Expert (sudo)</h1>
<p>Nyomozz hogyan és miért műküdik a sudo parancs! Ha megtaláltad próbáld meg összefoglalni nekünk néhány mondatban.</p>
<p>Hint: setuid</p>
</section>
<section id="expert-csomag-mágus" class="slide level1">
<h1>Expert (Csomag mágus)</h1>
<p>Készíts egy új csomagot (package) egy általad válaszott programból (saját program is lehet), egy általad választott disztribúcióhoz.</p>
</section>
<section id="jó-munkát" class="slide level1">
<h1>Jó munkát!</h1>
</section>
</div>
</div>
<script src="https://unpkg.com/reveal.js@^4//dist/reveal.js"></script>
// reveal.js plugins
<script src="https://unpkg.com/reveal.js@^4//plugin/notes/notes.js"></script>
<script src="https://unpkg.com/reveal.js@^4//plugin/search/search.js"></script>
<script src="https://unpkg.com/reveal.js@^4//plugin/zoom/zoom.js"></script>
<script>
// Full list of configuration options available at:
// https://revealjs.com/config/
Reveal.initialize({
// Push each slide change to the browser history
history: true,
// reveal.js plugins
plugins: [
RevealNotes,
RevealSearch,
RevealZoom
]
});
</script>
</body>
</html>
% Linux előadás
% Tóth Miklós
% March 21, 2021
# Pár egyéb hasznos parancs
# `wc`
- word counter
- szavak, sorok számolása
```shell-session
[mike@thinkyboi ~]$ echo "egy két há" | wc -w
3
[mike@thinkyboi ~]$ echo "egy két há" | wc -l
1
[mike@thinkyboi ~]$ echo "egy
két
há" | wc -l
3
```
# `tr`
- karaktereket cserél ki vagy töröl
```shell-session
[mike@thinkyboi ~]$ echo "almafa" | tr "a" "e"
elmefe
[mike@thinkyboi ~]$ echo "almafa körtefa eperfa" | tr " " "\n"
almafa
körtefa
eperfa
[mike@thinkyboi ~]$ echo "almafa" | tr -d "a"
lmf
```
# `curl`
- http shellből
- stdout-ra írja ki, kivéve, ha van `-o` kapcsoló
```shell-session
[mike@thinkyboi ~]$ curl https://home.sch.bme.hu/~mikewashere/linux/eloadas.md | grep stdout
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 777 100 777 0 0 33782 0 --:--:-- --:--:-- --:--:-- 33782
- stdout-ra írja ki
[mike@thinkyboi ~]$ curl https://home.sch.bme.hu/~mikewashere/linux/eloadas.md -o eloadas.md
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 777 100 777 0 0 31080 0 --:--:-- --:--:-- --:--:-- 31080
[mike@thinkyboi ~]$
```
# `.sh` fileok
- shell automatizálása
- mintha soronként kiadnánk a parancsokat
# egy `.sh` file
```shell-session
[mike@thinkyboi tmp]$ vi test.sh
[mike@thinkyboi tmp]$ cat test.sh
echo "ez simán működik" | cowsay
curl "https://home.sch.bme.hu/~mikewashere/linux/eloadas.md" | grep "soronként" | cowsay
[mike@thinkyboi tmp]$ bash test.sh
_____________________
< ez simán működik >
---------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1596 100 1596 0 0 69391 0 --:--:-- --:--:-- --:--:-- 69391
_________________________________
/ - mintha soronként kiadnánk a \
\ parancsokat /
---------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
[mike@thinkyboi tmp]$
```
# shebang
- file futtatásakor a kernel meglesi mi van az elején
- el tudunk indítani scripteket programként
- `#!<program>`
# shebang
```shell-session
[mike@thinkyboi tmp]$ vi test.sh
[mike@thinkyboi tmp]$ cat test.sh
#!/bin/bash
echo "ez simán működik" | cowsay
curl "https://home.sch.bme.hu/~mikewashere/linux/eloadas.md" | grep "soronként" | cowsay
[mike@thinkyboi tmp]$ chmod +x test.sh
[mike@thinkyboi tmp]$ ./test.sh
_____________________
< ez simán működik >
---------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1596 100 1596 0 0 11319 0 --:--:-- --:--:-- --:--:-- 11319
_________________________________
/ - mintha soronként kiadnánk a \
\ parancsokat /
---------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
[mike@thinkyboi tmp]$
```
# tűzfal
- a kernel belsejében -> gyors, de low-level
- iptables
- kényelmesebb egy tűzfal-kezelő
# UFW
- uncomplicated firewall
- egyszerű
```shell-session
[mike@thinkyboi tmp]$ sudo ufw allow 80
Rules updated
Rules updated (v6)
[mike@thinkyboi tmp]$ sudo ufw allow https
Rules updated
Rules updated (v6)
[mike@thinkyboi tmp]$ sudo ufw enable
```
# SSH kulcsok
- biztonságosabb, mint egy jelszó
- sok algoritmus, RSA, elliptikus görbék
- publikus-privát
- privát saját gépen, védve
- publikus ott, ahova belépnénk
- `~/.ssh/authorized_keys`
# Generálás
```shell-session
mike@thinkyboi:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/mike/.ssh/id_rsa):
Created directory '/home/mike/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/mike/.ssh/id_rsa
Your public key has been saved in /home/mike/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:tYZX08XEZfJP5j/um2Y9KUgG+jffe82ONwgzkt4p0hc mike@thinkyboi
The key's randomart image is:
+---[RSA 3072]----+
| .+*|
| . =o|
| . o . +|
| + o . +.|
| S * o|
| . = E .|
| + = B .o=|
| . = B ooBO|
| . + o.*XB|
+----[SHA256]-----+
mike@thinkyboi:~$ cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDjAZMAbpNutuc/ZgHWMcjWcPQOC0d8+JrDaHMnxZfRtfdyrgZDfPmMER95148JVEfkjjhur8a+IEfQM59o+yq95+yNvJFT6Nr5JzHK8dC5IuDvvEVNrKPwmW4UIgm1e5b95pGivJ5cnoiXevtp87seaxh0DlZFONKUeIFnwyDBUII7mRyXDn7MrFlAcxXtlZnSSCXXLGUMZI7nldiyRI9gXlZYCpfA8XrXrnM6JAIA+6VozhJurAKhygV6rH5yD4Vg+/Bs+wigywE3U79gbqpPzRegmxzKdgv+NNKV900DQVYNzvCU5o6q9d2amU+CDSw6KjU+4SLFOgZ3myXCyE9er3aaROj22sQdPwv8CnwtZstRibpp2SU627J4Vr7caPl8wrZcGvmXgD50mPh9Kdd+Yr5WJFSaAcog082aWBdrB3Qr9LM5DgcWulyDmUMmjA2WWCJN+t6vDT5d+2mYeBiZ2OY5ZkHyUjD6GVGBOZP/lP9EAxi3XwoM3V8TwoEgLD8= mike@thinkyboi
mike@thinkyboi:~$
```
# `>>` operátor
- `>` tesója
- filehoz appendál
```shell
curl https://git.sch.bme.hu/mikewashere.keys >> ~/.ssh/authorized_keys
```
# Házi Feladatok
# Alap házi
Csinálj felhasználót a csapattársaidnak a VM-edre úgy, hogy
hozzáférjenek a statikus weboldalak mappájához,
ezután próbáljátok ki, hogy valóban hozzáfértek-e
és ha igen, rakjatok valami funky html-t a mappába ajándékba a társaitoknak.
Hint: adduser/useradd, usermod/gpasswd, chmod.
# Side Quest
Állíts be kulcsos hitelesítést a képzés VM-eden az SSH kapcsolatodhoz.
Ehhez szükséged lesz egy privát és egy publikus kulcsra a kliensgépeden.
Hint: ssh-keygen.
# Expert (sudo)
Nyomozz hogyan és miért műküdik a sudo parancs!
Ha megtaláltad próbáld meg összefoglalni nekünk néhány mondatban.
Hint: setuid
# Expert (Csomag mágus)
Készíts egy új csomagot (package) egy általad válaszott programból
(saját program is lehet), egy általad választott disztribúcióhoz.
# Jó munkát!
presentation.html
index.html
---
marp: true
theme: gaia
class: [lead, invert]
---
# KSZKépzés Linux
Tóth Miklós
---
<!-- class: [invert] -->
## Mi is a Linux?
- kernel
- de! GNU/Linux már OS
- disztrók
- GUI
- CLI
---
## CLI
*Command Line Interface*
- terminál
- shell
- sh
- bash
- zsh
- fish
---
## Shelles fogalmak
- kapcsolók `rm -rf`
- redirekció `ls > fajllista.txt`
- piping `cat alma.txt | grep körte`
- shell execution `echo a mappa tartalma: $(ls)`
---
## Szövegszerkesztők
- nano
- vi, vim, nvim
---
## Gyakori parancsok
- ls
- man
- cat
- echo
- cd
- mkdir
- rm
- rmdir
- touch
---
## Csomagkezelés
- Mi a csomag?
- Hogyan telepítünk programokat Linuxon?
- Miért jó ez?
- Hogy működik az `apt`?
---
## Fájlkezelés
- `/` jel van `\` helyett
- nincs `C:\`, hanem `/`-ből indul minden
- `/etc`, `/dev`, `/home`, `/bin`, `/lib`, `/proc`, stb.
- `../`, `./`, `~`, `~bela`
---
## Jogosultságok
- `user`, `group`, `others`
- `rwx` hármasok
- `setuid`, `setgid`, `sticky bit`
- `chmod`, `chown`, `chgrp`
---
## UNIX elvek
- KISS
- Everything is a file
---
## Architektúra
- Bootloader
- Kernel
- Init rendszer
- "Userland"
---
## Felhasználókezelés
- `useradd`, `usermod`, `userdel`
- (`adduser`, `deluser`)
- `passwd`
- `sudo`
---
## Csoportok
- `groups`
- `groupadd`, `groupdel`
- `usermod`
- `gpasswd`
---
## Init rendszer, systemd
- Miért?
- Mi egy service?
- systemctl
- journalctl
---
## Hálózat
- `ip address`, `ip addr add`
- `ip route`, `ip route add`
- hálózatkezelők, `NetworkManager`
---
## SSH
- secure remote shell
- kulcsok
- sok egyéb okos feature
---
<!-- class: [lead, invert] -->
# Kahoot!
---
# Workshop time!
---
<!-- class: [invert] -->
## 1. feladat
Telepíts fel egy apache2 webszervert és állítsd be, hogy egy mappában lévő szkripteket lefuttasson és kimenetüket leküldje!
---
```sh
sudo ln -s /etc/apache2/mods-available/cgi.load /etc/apache2/mods-enabled/
```
```sh
sudo nano /etc/apache2/sites-enabled/000-default.conf
```
```
<VirtualHost *:80>
[...]
<Directory "/var/www/html/scripts">
AllowOverride None
Require all granted
Options +ExecCGI
AddHandler cgi-script .cgi .pl .py .sh
</Directory>
DocumentRoot /var/www/html
[...]
</VirtualHost>
```
---
```sh
#!/bin/bash
echo Content-type: text/html
echo
echo hello world
```
---
## 2. Feladat
- Nézzük meg milyen userként fut a webszerver!
- Csináljunk egy oldalt, ami kiírja az időt és azt, hogy hány user van belépve!
- Csináljunk egy oldalt, ami kiírja, hogy hányadik hét van!
- hint: `jq`, https://hanyadikhetvan.attiss.eu/api
\ No newline at end of file
favicon.ico

117 KiB

# Gyakorlat
## 0. csatlakozás a VM-hez
[see here](saját%20vm.md)
Ha gondoljátok vagy ha valaki nem nézett videót/jegyzetet és nem érti mi van,
akkor akár itt érdemes shellt mutogatni.
## 1. saját user létrehozása root jogokkal
Mindenki választ magának usert (nem kell schacc legyen), aztán
```shell
sudo useradd -s /bin/bash -m bela
```
`-m` = legyen home mappa
ha megadják a `-G sudo` kapcsolót is, akkor nice, már van is sudo joguk,
a kövi rész skippelhető
legyen jelszó:
```shell
passwd bela
```
legyen sudo:
```shell
sudo usermod -aG sudo bela
```
ezzel lett sudo joga
### Alternatív
legyen user:
```shell
sudo adduser bela
```
legyen sudo:
```shell
sudo adduser bela sudo
```
---
a végén jelentkezzetek át az új userbe
## 2. shell játszadozás
Feladat: számoljuk meg, hogy a *Bee Movie* szövegében hányszor szerepel a
kis és nagybetűs "bee" szó.
Ha lehet oldják meg maguktól, de vezethetitek is.
A szöveg elérhető itt: https://home.sch.bme.hu/~mikewashere/linux/best_movie_ever.txt
Vezessük végig őket lépésenként, hogy mit csinál a csomó parancs:
```shell
curl https://home.sch.bme.hu/~mikewashere/linux/best_movie_ever.txt
```
-> letölti a szöveget és kiírja
olvassunk be less-sel
```shell
curl https://home.sch.bme.hu/~mikewashere/linux/best_movie_ever.txt | less
```
Na de oldjuk is meg a feladatot:
Okés, de:
számolni a `wc`-vel lehet, de kéne szűrni a bee-kre, arra kell a `grep`,
de:
a `grep` az egész sort odaadja, amiben egyszer is ott a bee
tehát szét kéne szedni úgy, hogy minden szó külön sor legyen
Megoldás: cseréljük ki a space-eket `\n`-re a `tr` használatával.
```shell
curl https://home.sch.bme.hu/~mikewashere/linux/best_movie_ever.txt | tr " " "\n"
```
Az idézőjelek fontosak.
Most már soronként jelenik meg, mehet a grep.
```shell
curl https://home.sch.bme.hu/~mikewashere/linux/best_movie_ever.txt | tr " " "\n" | grep -i bee
```
Na most van egy csomó bee-nk, mehet a wc.
```shell
curl https://home.sch.bme.hu/~mikewashere/linux/best_movie_ever.txt | tr " " "\n" | grep -i bee | wc -l
```
Elvileg **171**-et kéne kapni.
Ha zavar minket a curl letöltés mutató szövege, akkor adjunk neki egy `2>/dev/null`-t.
```shell
curl https://home.sch.bme.hu/~mikewashere/linux/best_movie_ever.txt 2>/dev/null | tr " " "\n" | grep -i bee | wc -l
```
2 = stderr, /dev/null = speciális file, amibe bármit írhatunk, elveszik
---
Feladat: A méhek száma évről évre csökken, *let's save the bees*!
Írjuk bele a "bee"-ket egy fileba!
```shell
curl https://home.sch.bme.hu/~mikewashere/linux/best_movie_ever.txt | tr " " "\n" | grep -i bee > save_the_bees.txt
```
`nano save_the_bees.txt`-vel megleshetjük, hogy működött.
## 3. Script irogatás
Feladat: csináljunk egy scriptet, ami megmenti a méheket, és egy tehénnel kimondatja, hogy
hányan vannak.
A `cowsay` nincs fent a VM-eken, telepítsétek.
```shell
sudo apt install cowsay
```
Nyugodtan próbálgassátok ki.
```shell
cowsay hello
echo hello | cowsay
```
Csináljunk nano-val (vagy vim-mel, ha valaki azt szereti inkább)
egy új file-t, nevezzük el `bees.sh`-nak.
```shell
nano bees.sh
```
Vezessétek végig őket a megírásán vagy csináltassátok meg velük, itt egy mintamegoldás:
```shell
#!/bin/bash
curl https://home.sch.bme.hu/~mikewashere/linux/best_movie_ever.txt | tr " " "\n" | grep -i bee > save_the_bees.txt
echo $(cat save_the_bees.txt | wc -l ) méh van. | cowsay
```
*A felső sor opcionális.*
Ha megvan, futtassátok:
```shell
bash bees.sh
```
vagy, ha odatettétek az elejére a shebang-et:
```shell
chmod +x bees.sh
./bees.sh
```
## 4. Webszerver telepítése
Feladat: állítsanak be egy webszervert nginx-el, és rakjanak ki valami szöveget.
Telepítés:
```shell
sudo apt install nginx
```
Magától elindul, nézzük meg:
```shell
systemctl status nginx
```
Alapból a `/var/www/html`-t szolgálja ki, menjünk oda
```shell
cd /var/www/html
ls -la
```
Látjuk, hogy root-é minden, adjuk oda a www-data-nak, magunknak meg adjunk www-data csoporttagságot
és adjunk a csoportnak minden jogot rekurzívan.
```shell
sudo chown -R www-data:www-data /var/www/html
sudo usermod -aG www-data bela
sudo chmod -R g+rwx /var/www/html
```
`-R`: rekurzívan
vegyük fel a csoporttagságot, ehhez vagy ki és bejelentkezni kell vagy:
```shell
newgrp www-data
```
Most töröljük a korábbi weblapot és tegyünk ki valami sajátot:
```shell
cd /var/www/html
rm index.nginx-debian.html
nano index.html # írjanak bele bármi funky szöveget
```
## 5. Csináljunk tűzfalat
Az UFW (Uncomplicated FireWall) egy egyszerű tűzfalvezérlő progi.
Nézzük meg fut-e:
```shell
sudo systemctl status ufw
sudo ufw status
```
Fut, de ki van kapcsolva.
Előszöris engedjük be az SSH-t és http-t, hogy ne zárjuk ki magunkat:
```shell
sudo ufw limit ssh
sudo ufw allow http
```
A limit-tel limitálva engedélyeztük az ssh-t, így nem lehet gyorsan brute-force-olni.
és kapcsoljuk be:
```shell
sudo ufw enable
sudo ufw status
```
nice.
## Extra feladatötlet turbóújoncoknak
Csináljanak valami fancy weboldalt. Bármit.
# Házi Feladatok
## Alap házi
Csinálj felhasználót a csapattársaidnak a VM-edre úgy, hogy
hozzáférjenek a statikus weboldalak mappájához,
ezután próbáljátok ki, hogy valóban hozzáfértek-e
és ha igen, rakjatok valami funky html-t a mappába ajándékba a társaitoknak.
Hint: adduser/useradd, usermod/gpasswd, chmod.
## Side Quest
Állíts be kulcsos hitelesítést a képzés VM-eden az SSH kapcsolatodhoz.
Ehhez szükséged lesz egy privát és egy publikus kulcsra a kliensgépeden.
Hint: ssh-keygen.
## Expert (sudo)
Nyomozz hogyan és miért műküdik a sudo parancs!
Ha megtaláltad próbáld meg összefoglalni nekünk néhány mondatban.
Hint: setuid
## Expert (Csomag mágus)
Készíts egy új csomagot (package) egy általad válaszott programból
(saját program is lehet), egy általad választott disztribúcióhoz.
......@@ -4,24 +4,83 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>KSZKépzés Linux</title>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<script async defer data-domain="home.sch.bme.hu" src="https://analytics.mikesweb.site/js/plausible.js"></script>
<link rel="icon" type="image/x-icon" href="favicon.ico" />
<link rel="stylesheet" href="https://unpkg.com/docute@4/dist/docute.css">
<style>
.medium-zoom-overlay {
background: #2f3136 !important;
}
</style>
</head>
<body>
<div id="docute"></div>
<script src="https://unpkg.com/docute@4/dist/docute.js"></script>
<script>
new Docute({
target: '#docute',
title: 'Linux',
layout: 'wide',
highlight: [
"bash",
"javascript",
"html"
],
detectSystemDarkTheme: true,
darkThemeToggler: true,
})
async function init() {
try {
const keys = await caches.keys();
for (const key of keys) {
const cache = await caches.open(key);
const cacheKeys = await cache.keys();
for (const k of cacheKeys) {
await cache.delete(k);
}
}
} catch (e){
console.log(e);
}
let tmp = [
"linux alapok",
"szerver kezelés",
];
let pages = [];
tmp.forEach(val => {
pages.push({
title: val,
link: encodeURI("/" + val),
});
});
new Docute({
target: '#docute',
title: 'Linux',
layout: 'wide',
highlight: [
"bash",
"javascript",
"html",
"shell-session"
],
detectSystemDarkTheme: true,
darkThemeToggler: true,
nav: [
{
title: "/",
link: '/'
},
{
title: "Source",
link: "https://git.sch.bme.hu/mikewashere/linux-presentation"
},
],
sidebar: [
{
title: "linux/",
children: pages,
},
],
fetchOptions: { cache: 'no-cache' },
});
console.log("i like your curiosity");
}
init();
</script>
</body>
</html>
\ No newline at end of file
</html>
apiVersion: apps/v1
kind: Deployment
metadata:
name: linux-presentation
namespace: kszk-kepzes-site
spec:
selector:
matchLabels:
app: linux-presentation
template:
metadata:
labels:
app: linux-presentation
spec:
containers:
- name: linux-presentation
image: harbor.sch.bme.hu/kszk/linux-presentation:latest
resources:
limits:
memory: "64Mi"
ports:
- containerPort: 80
imagePullSecrets:
- name: harbor
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
kubernetes.io/ingress.class: nginx
kubernetes.io/tls-acme: 'true'
nginx.ingress.kubernetes.io/proxy-body-size: 20m
nginx.ingress.kubernetes.io/rewrite-target: /$1
name: linux-presentation
namespace: kszk-kepzes-site
spec:
rules:
- host: ujonc.kszk.bme.hu
http:
paths:
- path: /studies/linux/(.*)
pathType: Prefix
backend:
service:
name: linux-presentation
port:
number: 80
tls:
- hosts:
- ujonc.kszk.bme.hu
secretName: kszkepzes-cert
apiVersion: v1
kind: Service
metadata:
name: linux-presentation
namespace: kszk-kepzes-site
spec:
selector:
app: linux-presentation
ports:
- port: 80
targetPort: 80
This diff is collapsed.