1. download all
mysqldump --all-databases --user=root --password > database.sql
2. restore
mysql -u root -p < database.sql
#groupadd -g 4200 sysadmin2
#useradd appadmin1 -u 4100 -g 4100 -s /bin/bash
#deluser ...
2. useradd command and compare adduser ref
useradd is law level
The command useradd is also used to add users. It comes with some flags. Some of them are as follows.
-D Defaults
-m Creates a home directory
-s Defines the shell for the user
-e Date on which the user account will be disabled
-b Base directory for the home directory of the user
-u UID
-g Initial group number
-G Additional groups by name
-c Comment
1. disk create
pve->磁碟->Direcory->建立 Directory
2. linux Linux 檔案系統掛載(mount)使用教學與範例
3. create partion ref
1 Good ref
pct create <id> /var/lib/vz/template/cache/centos-7-default_20170504_amd64.tar.xz \ | |
-arch amd64 \ | |
-ostype <centos|ubuntu|etc> \ | |
-hostname <hostname> \ | |
-cores <cores> \ | |
-memory <memory(MB)> \ | |
-swap <swap(MB)> \ | |
-storage local-lvm \ | |
-password \ | |
-net0 name=eth0,bridge=<bridge>,gw=<gateway>,ip=<cidr>,type=veth &&\ | |
pct start <id> &&\ | |
sleep 10 &&\ | |
pct resize <id> rootfs <storage(ex: +4G)> &&\ | |
pct exec <id> -- bash -c "yum update -y &&\ | |
yum install -y openssh-server &&\ | |
systemctl start sshd &&\ | |
useradd -mU hogeuser &&\ | |
echo "password" | passwd --stdin hogeuser" |
Hi,
As it looks like you have an unprivileged container.
This means that the UID/GID is mapped.
So root with UID 0 in the container is UID 100000 on the host.
Every UID/GID in the container is +100000 on the host.
You can set the permission on the host that it matches to the bind-mount or you can remap the UID/GID.
For the remapping see [1]
Or just run the container in privileged mode then the mapping is the same.
I would not install docker direct on the host because this can have dependency problems.
It's not included in our tests, so you're alone with such a setup.
1.) https://pve.proxmox.com/wiki/Unprivileged_LXC_containers
lxc.idmap = u 0 100000 10000 lxc.idmap = g 0 100000 10000
user
:start_uid
:uid_count
Add an entry for the dockremap
user if you plan to configure default user namespace remapping. Alternately, add an entry for the unprivileged user that you are going to use for this purpose. For example:
dockremap:100000:65536
subuid - the subordinate uid file
Each line in /etc/subuid contains a user name and a range of subordinate user ids that user is allowed to use. This is specified with three fields delimited by colons (":"). These fields are:
7. pod man ref
/etc/subuid:johndoe:200000:1001
/etc/subgid:johndoe:200000:1001
8. An unprivileged LXC container ref
So even
root
can own unprivileged containers, since the effective UIDs of container processes on the host will end up inside the range defined by the mapping.However, for
root
you have to define the subordinate IDs first. Unlike users created viaadduser
,root
will not have a range of subordinate IDs defined by default.
he most common example and what most LXD users will end up with by default is a map of 65536 UIDs and GIDs, with a host base id of 100000. This means that root in the container (uid 0) will be mapped to the host uid 100000 and uid 65535 in the container will be mapped to uid 165535 on the host. UID/GID 65536 and higher in the container aren’t mapped and will return an error if you attempt to use them.
From a security point of view, that means that anything which is not owned by the users and groups mapped into the container will be inaccessible. Any such resource will show up as being owned by uid/gid “-1” (rendered as 65534 or nobody/nogroup in userspace). It also means that should there be a way to escape the container, even root in the container would find itself with just as much privileges on the host as a nobody user.
先撇除一般Hypervisor 不談(大家應該都很熟悉了),在了解Docker之前我們應該先來了解,什麼是 LXC (Linux Container)?我們現來看一下他的定義:
LXC (LinuX Containers) provide an isolated operating system environment with its own file system, network, process and block I/O space. A favorite way to describe containers is that they are like “chroot on steroids”, since they provide the file system isolation that chroot jails provide but they go beyond that by also providing an IP address, a separate process domain, user ids and dedicated access to the host’s physical resources (i.e. memory, CPU) which chroot jails do not provide
Credit Diego Elio “Flameeyes” Pettenò |
LXC virtual environment has no hardware preload emulation. Each virtual environment (an OS or an application) is loaded in a container and executes without any additional overhead and no hardware emulation. This means no penalty from software with limited memory. In the end, LXC will improve the performance of the bare metal as it only bundles the OS/application that is required.
Containers are a lightweight alternative to fully virtualized machines (VMs). They use the kernel of the host system that they run on, instead of emulating a full operating system (OS). This means that containers can access resources on the host system directly.
The runtime costs for containers is low, usually negligible. However, there are some drawbacks that need be considered:
Only Linux distributions can be run in Proxmox Containers. It is not possible to run other operating systems like, for example, FreeBSD or Microsoft Windows inside a container.
For security reasons, access to host resources needs to be restricted. Therefore, containers run in their own separate namespaces. Additionally some syscalls (user space requests to the Linux kernel) are not allowed within containers.
For those that don't know.
Privileged containers: container uid 0 is mapped to the host's uid 0.
Unprivileged containers: container uid 0 is mapped to an unprivileged user on the host.
Unprivileged should be chosen unless you need a privileged container.
My thoughts: I haven't had a need for a privileged container. I can't think of a reason to use one. Maybe if I needed something that needed to access some hardware that couldn't be mapped to an unprivileged container?
pct push 100 gitea-1.15.9-linux-amd64 /opt/gitea/gitea
pct enter 100
https://pve.proxmox.com/wiki/Linux_Container#pct_mount_points
http://www.gienginali.idv.tw/modules/tad_book3/page.php?tbdsn=505
https://pve.proxmox.com/wiki/Linux_Container#pct_mount_points
6. alpine rc
https://docs.alpinelinux.org/user-handbook/0.1a/Working/openrc.html
root@pve:~# cat /etc/pve/lxc//100.conf
arch: amd64
cores: 2
features: nesting=1
hostname: myalpine
memory: 512
mp0: /mnt/pve/sdbc_data/machine/100myalpine,mp=/mnt/data
net0: name=eth0,bridge=vmbr0,firewall=1,gw=10.0.255.254,hwaddr=E6:E1:B8:81:DC:BA,ip=10.0.3.1/16,type=veth
ostype: alpine
rootfs: local-lvm:vm-100-disk-0,size=2G
swap: 512
# use privilege that can read wirte disck
unprivileged: 0
https://ihower.tw/blog/archives/6483
https://softwareengineering.stackexchange.com/questions/114156/why-are-there-no-put-and-delete-methods-on-html-forms
https://blog.kalan.dev/2021-03-13-html-form-data/
https://developer.mozilla.org/zh-TW/docs/Web/HTTP/Headers/Content-Type
https://stackoverflow.com/questions/630453/what-is-the-difference-between-post-and-put-in-http
1. https://nextcloud.com/install/
2. https://iter01.com/604295.html
3. https://hub.docker.com/_/nextcloud?tab=tags
4. https://github.com/nextcloud/docker/blob/e2dc98dea469ba67c3e6474aa4fc2cf902f8e9a4/23/apache/Dockerfile
5. https://github.com/docker-library/docs/blob/master/nextcloud/README.md
6. https://github.com/docker-library/docs/tree/master/nextcloud
7. https://github.com/nextcloud/docker/blob/master/23/apache/Dockerfile
8. https://help.nextcloud.com/t/docker-compose-nextcloud-apache-mariadb/89031
9. https://mariushosting.com/synology-how-to-install-nextcloud-using-docker/
10. https://github.com/nextcloud/server