顯示具有 debian 標籤的文章。 顯示所有文章
顯示具有 debian 標籤的文章。 顯示所有文章

2020年4月29日 星期三

debian x64 os binfmts qemu i386

在 debina x64 os 執行 i386的 exe檔會很慢 或是會出錯。



https://manpages.debian.org/testing/binfmt-support/update-binfmts.8.en.html


update-binfmts --display



i386 (disabled):
     package = <local>
        type = magic
      offset = 0
       magic = \x7fELF\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00
        mask = \xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xf8\xff\xff\xff\xff\xff\xff\xff
interpreter = /usr/bin/qemu-i386-static
    detector =


update-binfmts --remove i386 /usr/bin/qemu-i386-static


update-binfmts: warning: no executable /usr/bin/qemu-i386-static found, but continuing anyway as you request



i386

https://coldnew.github.io/5cecf128/

透過 binfmt_misc 讓 Linux 可以執行不同格式的執



cat /proc/sys/fs/binfmt_misc/i386
enabled
interpreter /usr/bin/qemu-i386-static
flags:
offset 0
magic 7f454c460101010300000000000000000300030001000000
mask fffffffffffffffcfffffffffffffffff8ffffffffffffff


https://www.kernel.org/doc/Documentation/admin-guide/binfmt-misc.rst


echo -1 > /proc/sys/fs/binfmt_misc/i386

2018年11月14日 星期三

linux netcat

參考
https://blog.gtwang.org/linux/linux-utility-netcat-examples/


檔案接收者
nc -l 5000 > branch-rtl819x-sdk-v3.4.11.tar

nc 172.21.69.1 5000 < branch-rtl819x-sdk-v3.4.11.tar


nc -l 50000 > my_svn_new_checkout.sh

nc 172.21.69.4 5000 < my_svn_new_checkout.sh


在兩台主機之間複製檔案
假設現在有兩台主機,分別為 A 主機與 B 主機,若要將一個檔案從 A 主機複製到 B 主機,可以先在 B 主機(檔案接收者)上執行:

nc -l 5000 > my.jpg
然後在 A 主機(檔案傳送者)上執行:

nc hostB.com 5000 < my.jpg
這樣就可以把 my.jpg 這個檔案從 A 主機複製到 B 主機上了。 雖然這個方式跟 scp 指令比起來可能不是最方便的,但是它的特點是不需要登入的動作(也就是說不需要任何帳號與密碼),假設你碰到兩台主機無法互相登入的時候,就可以使用這樣的方式處理。


接收端
ubuntu  18.04

nc -l 50000 > my_svn_new_checkout.sh



傳送端
debian 9.6

nc 172.21.69.4 50000 -q 1 < my_svn_new_checkout.sh



傳送端
ubuntu  18.04

nc 172.21.15.145 50000 -q 1 < my_svn_new_checkout.sh


     -N      shutdown(2) the network socket after EOF on the input.  Some servers
             require this to finish their work.




centos 7 防火牆 注意
sudo firewall-cmd --zone=public --add-port=50000-55500/tcp --permanent

sudo firewall-cmd --reload

sudo firewall-cmd --zone=public --list-ports
19999/tcp 5001/tcp 5201/tcp 50000-55500/tcp


centos firewall reference
https://unix.stackexchange.com/questions/409878/centos-7-open-a-port
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-using-firewalld-on-centos-7
https://mangolassi.it/topic/8380/centos-7-open-firewall-ports-range-on-firewalld

https://www.thegeekdiary.com/how-to-test-port-connectivity-using-nc-utility-in-centos-rhel/



netcat 參考
https://www.linuxtechi.com/nc-ncat-command-examples-linux-systems/
https://www.arthurtoday.com/2015/10/ubuntu-replace-telnet-with-nc-command.html
https://www.tecmint.com/check-remote-port-in-linux/
https://ithelp.ithome.com.tw/articles/10136033

firewall and netcat
https://fabianlee.org/2016/09/26/ubuntu-pre-validate-network-acl-and-firewall-connectivity-with-netcat/
https://itekblog.com/test-firewall-with-netcat/
https://www.digitalocean.com/community/tutorials/how-to-use-netcat-to-establish-and-test-tcp-and-udp-connections-on-a-vps


debian firewall
https://wiki.debian.org/DebianFirewall


netcat for window 下載
https://eternallybored.org/misc/netcat/

2010年12月1日 星期三

debian linux bashrc

# ~/.bashrc: executed by bash(1) for non-login shells.

# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
PS1='[\[\e[1;31m\]\u@\[\e[1;33m\]\h \[\e[1;32m\]\W\[\e[0m\]]\[\033[1;36m\]\A\[\033[0m\]\$ '
PATH=$PATH:/toolchain/rsdk/linux/
#
# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'

example output of PS1:
[root@debian-u5a ~]10:54# 



linux bash reference artical
http://web.mit.edu/gnu/doc/html/features_1.html