The Linux emulator "iSH" that runs on the iPad is a hot topic in me

iSH setup

install apk

By default, the package manager apk is not installed, so install it.

$ wget -qO- http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86/apk-tools-static-2.10.5-r1.apk | tar -xz sbin/apk.static && ./sbin/apk.static add apk-tools && rm sbin/apk.static && rmdir sbin 2> /dev/null

apk update

$ apk update
$ apk upgrade

At least try various

$ apk add zsh vim git openssh

Change default shell

$ vim /etc/passwd
#Change before
root:x:0:0:root:/root:/bin/ash
#After change
root:x:0:0:root:/root:/bin/zsh

Restart iSH after making changes. Then the prompt is displayed as \ h: \ w \ $ and it is hard to see, so let's change the prompt. I want to make it common to all users, so create / etc / zshrc.

setopt PROMPT_SUBST     # allow funky stuff in prompt

if [ "$USER" = "root" ]; then
    color="red"         # root is red, user is cyan
else
    color="cyan"
fi;


local ok_yuno="%F{yellow}✘╹◡╹✘%f"
local bad_yuno="%F{red}✘>﹏<✘%f"
local command_line="
%F{green}%B%*%b%f %F{$color}%B%n@%m%b%f %F{green}%B%~%b%f
%(?.${ok_yuno}.${bad_yuno}) %F{yellow}%B%#%b%f "

export PROMPT="${command_line}"

Also / etc / vimrc

syntax enable

set number
set title
set cursorline
set virtualedit=onemore
set showmatch
set expandtab
set tabstop=2
set shiftwidth=2
set autoindent
set smartindent
set hlsearch
nmap <Esc><Esc> :nohlsearch<CR><Esc>

set fenc=utf-8
set encoding=utf-8
scriptencoding utf-8
set ambiwidth=double

inoremap { {}<Left>
inoremap {<Enter> {}<Left><CR><ESC><S-o>
inoremap ( ()<ESC>i
inoremap (<Enter> ()<Left><CR><ESC><S-o>
inoremap [ []<Left>
inoremap ' ''<Left>
inoremap " ""<Left>

nnoremap j gj
nnoremap k gk
nnoremap <down> gj
nnoremap <up> gk

Keep iSH running in the background

It's a magical magic.

$ cat /dev/location > /dev/null &

Next, always allow the use of iSH location information in the iPad OS settings app.

Log in to iSH from your favorite client with SSH

The iSH terminal is a bit dull, so it would be great if you could operate it from a client you're used to. Here, I will try to operate iSH using the Blink Shell recommended by Minori.

Prepare with iSH

Port 22000 #Cannot be accessed from the same device at number 22
PermitRootLogin yes #Change to No later
PubkeyAuthentication yes
PasswordAutentication yes #Change to No later
ClientAliveInterval 60 #As you like so that the SSH is uninterrupted
ClientAliveCountMax 60
$ passwd #Decide on a root password
$ ssh-keygen -A
$ /usr/sbin/sshd

All you have to do is connect from your favorite client (o ・ ω ・ o)

ssh root@localhost -p 22000

Add general users

$ adduser -s /bin/zsh minorin
$ addgroup minorin wheel

Install sudo

$ apk add sudo
$ visudo
#Uncomment
%wheel ALL=(ALL) ALL

SSH settings

Key creation

$ su minorin
$ chmod 755 /home/minorin
$ cd
$ mkdir .ssh
$ chmod 700 .ssh
$ cd .ssh
$ touch authorized_keys
$ chmod 600 authorized_keys
$ ssh-keygen
$ chmod 600 id_rsa

Then copy and paste the client's public key into autorized_keys.

sshd_config setting

PermitRootLogin no
PasswordAutentication no
AddressFamily inet
UseDNS no
$ sudo /usr/sbin/sshd

All you have to do now is make sure you can SSH from your usual client with key authentication.

ssh minorin@localhost -p 22000

like openrc

$ apk add openrc
$ rc-update add sshd

This should start sshd automatically, but it doesn't work (; ∀ ;)

code-server installation

$ apk add alpine-sdk libstdc++ libc6-compat npm libx11-dev libxkbfile-dev libsecret-dev python3
$ npm config set unsafe-perm true
$ npm config set python python3
$ npm install -g @google-cloud/[email protected]
$ npm install -g code-server
npm WARN @coder/[email protected] requires a peer of @google-cloud/logging@^4.5.2 but none is installed. You must install peer dependencies yourself.

npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path /usr/lib/node_modules/code-server/node_modules/tar-fs/node_modules/chownr
npm ERR! dest /usr/lib/node_modules/code-server/node_modules/tar-fs/node_modules/.chownr.DELETE
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/lib/node_modules/code-server/node_modules/tar-fs/node_modules/chownr' -> '/usr/lib/node_modules/code-server/node_modules/tar-fs/node_modules/.chownr.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-**-*****_**_**_****-debug.log

It was no good (; ∀ ;)

Next time preview

I'm going to try VNC settings for the time being.

Recommended Posts

The Linux emulator "iSH" that runs on the iPad is a hot topic in me
Linux is something like that in the first place
Play a sound in Python assuming that the keyboard is a piano keyboard
Easy! Implement a Twitter bot that runs on Heroku in Python
On Linux, the time stamp of a file is a little past.
The NVM Checksum Is Not Valid, a solution to the problem that Intel's wired LAN is not recognized on Linux
Find a building on Google Earth that is the same height as Shingodzilla
Open a ZIP created on Windows in Linux
[2020July] Check the UDID of the iPad on Linux
Set a fixed IP in the Linux environment
It's a Mac. What is the Linux command Linux?
CodePicnic that can create a [Development | Run | Tutorial | Demo] environment that runs on the browser
A note on the library implementation that explores hyperparameters using Bayesian optimization in Python
[Django] Hit a command you made from within the process that runs on manage.py.
A note that runs an external program in Python and parses the resulting line
Check if the string is a number in python
Specify the volume on linux and make a sound
Create a QR code for the URL on Linux
Find the part that is 575 from Wikipedia in Python
Check if the LAN cable is disconnected on Linux
Write a log-scale histogram on the x-axis in python
How to delete "(base)" that appears in the terminal when Anaconda is installed on Mac
Workaround for the problem that sys.argv is not passed when executing a Python script with only the file name in Python2.7 on Windows