Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # >> Windows Subsystem Linux <<
- # <http://thewindowsclub.com/windows-10-installation-upgrade-errors>
- # >> Windows 10 Insider Preview <<
- # <http://microsoft.com/en-us/software-download/windowsinsiderpreviewadvanced>
- # >> Windows Server 2016 Insider Preview <<
- # <http://microsoft.com/en-us/software-download/windowsinsiderpreviewserver>
- #
- # <http://msdn.microsoft.com/en-us/commandline/wsl/install-on-server>
- # <http://insider.windows.com/pt-br/for-business/>
- # <http://stackoverflow.com/questions/40033608/enable-windows-10-developer-mode-programmatically>
- # <http://docs.microsoft.com/en-us/windows/wsl/install-win10>
- # cmd
- dir # mostra o espaço livre
- powershell
- # powershell
- systeminfo | Select-String "^OS Name","^OS Version"
- get-windowsFeature *linux
- install-windowsFeature -restart *linux
- get-windowsOptionalFeature -online -featureName *linux
- enable-WindowsOptionalFeature -online -featureName *linux -all -limitAccess -noRestart
- invoke-webRequest -uri https://aka.ms/wsl-ubuntu-1604 -outFile ubuntu.zip -useBasicParsing
- expand-archive ubuntu.zip ubuntu
- cd ubuntu
- ls
- ubuntu.exe
- # reset the Password in Linux Bash in Windows <http://askubuntu.com/a/808425>
- #
- # entrar no linux subsystem como root
- lxrun /setdefaultuser root
- cd %localappdata%\lxss
- dir
- cat /etc/lsb-release
- export DISPLAY=:0
- export TIMEFORMAT=%lR
- sudo -Si
- passwd
- scp -p arkanon@hulk:.ssh/id_rsa.pub ~/.ssh
- cat ~/.ssh/id_rsa.pub >| ~/.ssh/authorized_keys
- rm ~/.ssh/id_rsa.pub
- chmod 600 ~/.ssh/authorized_keys
- scp -p arkanon@hulk:/etc/apt/sources.list.d/* /etc/apt/sources.list.d
- sedc="
- s/[ \t]*#[ \t]*(deb )/\1/ # descomenta linhas de repositórios adicionais
- s/[ \t]*(deb-src |#).*// # limpa linhas com [deb-src ] e remove comentarios
- /^$/d # deleta linhas em branco
- s|br\.(archive)|\1| # troca do repositorio brasileiro para o oficial
- "
- sed -ri "$sedc" /etc/apt/sources.list
- time apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $( apt update 2>&1 | grep -oP '( NO_PUBKEY \K[^ ]+)+' | sort -u )
- time do-release-upgrade -f DistUpgradeViewNonInteractive -d
- apt-get install -f
- dpkg --configure -a
- apt -y install console-common
- # apt -y install openssh-server
- apt -y install synaptic apt-xapian-index
- apt -y install vim vim-gtk3 vim-gtk3-py2 exuberant-ctags
- update-apt-xapian-index # <http://superuser.com/a/1132327>
- synaptic
- # >> atualização <<
- (
- apt -y remove vim-tiny
- time apt update
- apt list --upgradable
- time apt -y full-upgrade
- )
- # >> limpeza <<
- (
- du -chs /var/cache/apt/archives/
- apt -y autoremove || apt-get -y autoremove
- dpkg --purge $(dpkg --get-selections | grep deinstall | cut -f1)
- apt clean || rm /var/cache/apt/archives/*.deb
- du -chs /var/cache/apt/archives/
- )
- scp administrador@hulk:/fs/etc/profile.d/bash-basic.sh /etc/profile.d/bash-basic.sh
- cat << \EOT >| /etc/profile.d/wsl.sh
- # /etc/profile.d/wsl.sh
- # Arkanon <arkanon@lsd.org.br>
- # 2017/09/19 (Tue) 14:59:41 BRT
- # 2017/09/19 (Ter) 09:27:02 BRT
- export DISPLAY=${DISPLAY:-:0}
- PATH=$PATH:/mnt/c/Windows
- PATH=$PATH:/mnt/c/Windows/System32
- PATH=$PATH:/mnt/c/Windows/System32/WindowsPowerShell/v1.0
- PATH=$PATH:/mnt/c/WINDOWS/System32/Wbem
- PATH=$PATH:/mnt/c/Windows/SysWOW64
- PATH=$PATH:/mnt/c/Windows/SysWOW64/WindowsPowerShell/v1.0
- PATH=$PATH:/mnt/c/WINDOWS/SysWOW64/Wbem
- PATH=$PATH:/mnt/c/ProgramData/chocolatey/bin
- PATH=$PATH:/mnt/c/Program\ Files/OpenSSH-Win64
- PATH=$PATH:/mnt/c/Program\ Files/SysInternals
- PATH=$PATH:/mnt/c/Users/${USER^}/AppData/Local/Microsoft/WindowsApps
- export PATH
- # EOF
- EOT
- chmod 755 /etc/profile.d/bash-basic.sh
- chmod 755 /etc/profile.d/wsl.sh
- ln -fs ~/.bashrc .profile
- cat << \EOT >| ~/.profile
- # ~/.profile
- # Arkanon <arkanon@lsd.org.br>
- # 2017/09/19 (Ter) 09:29:49 BRT
- # 2017/05/29 (Mon) 14:50:45 BRT
- # 2017/04/24 (Mon) 23:23:12 BRS
- # 2017/01/10 (Tue) 08:26:02 BRD
- # 2017/01/09 (Mon) 16:03:58 BRD
- # 2016/11/28 (Seg) 14:36:24 BRD
- # 2016/08/23 (Ter) 14:03:07 BRS
- # 2016/06/10 (Sex) 11:45:23 BRS
- # 2016/04/19 (Ter) 08:37:27 BRS
- export AD_CRED=$HOME/.crd
- export VPN_CRED=$AD_CRED
- export RDESK_CRED=$AD_CRED
- export PSEXEC_CRED=$AD_CRED
- export VIMSIGN1='Name <user@domain>'
- export VIMSIGN2='Name <user@domain>'
- export LC_COLLATE="C"
- # export LC_MESSAGES="C"
- # export HTTP_PROXY="http://fortigate.lsd.org.br:1000"
- # export HTTP_PROXY="http://wpad.lsd.org.br/wpad.dat"
- export http_proxy="$HTTP_PROXY"
- export HTTPS_PROXY="$HTTP_PROXY"
- export https_proxy="$HTTP_PROXY"
- # EOF
- EOT
- sudo visudo
- # %sudo ALL=(ALL) NOPASSWD: /usr/sbin/sshd -D
- # %sudo ALL=(ALL) NOPASSWD: /usr/sbin/synaptic
- # %sudo ALL=(ALL) NOPASSWD: /usr/sbin/visudo
- # %sudo ALL=(ALL) NOPASSWD: /usr/bin/apt
- # %sudo ALL=(ALL) NOPASSWD: /usr/bin/apt-get
- # ALL ALL=(root) NOPASSWD: /usr/sbin/service
- scp administrador@hulk:/fs/etc/vim/vimrc-basic /etc/vim/vimrc.local
- chmod 644 /etc/vim/vimrc.local
- # <http://noise.paulos.cz/post/windows10-14352-ssh-server/>
- HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Ssh\Broker\DevToolsUser
- <cmd>+<r>shell:startup
- <cmd>+<r>%appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar
- <cmd>+<r>%appdata%\..\Local\Microsoft\Windows\WinX\Group3
- # >> openssh-server <<
- vi /etc/ssh/sshd_config
- # Port 22
- # ListenAddress 0.0.0.0
- # PermitRootLogin yes
- # PasswordAuthentication yes
- # ChallengeResponseAuthentication yes
- # X11Forwarding yes
- # UsePrivilegeSeparation no
- # KbdInteractiveAuthentication yes
- #
- visudo
- # %sudo ALL=(ALL) NOPASSWD: /usr/sbin/sshd -D
- #
- sc stop lxssmanager
- #
- # >>atalho<<
- destino c:\windows\system32\bash.exe -c "sudo /usr/sbin/sshd -D"
- icone %USERPROFILE%\appdata\local\lxss\bash.ico
- #
- # >>vbs<<
- # c:\program files\openssh-win64\sshd.vbs
- set ws=wscript.createobject("wscript.shell")
- ws.run "c:\windows\system32\bash.exe -c 'sudo /usr/sbin/sshd -D'",0
- #
- # >>tarefa<< (não executa nem se configurado para iniciar no boot nem no logon, apenas sob demanda)
- #
- # geral
- # nome: WSL SSHd
- # executar: somente quando o usuário estiver conectado (permite execução sob demanda)
- # # estando o usuário conectado ou não (não permite sob demanda nem executa antes ou mesmo depois do logon)
- # executar com privilégios mais altos: true
- # oculto: true
- # configurar para: windows 10
- # disparadores
- # iniciar a tarefa: ao inicializar
- # # atrasar a tarefa em: 1 min
- # habilitado: true
- # ações
- # ação: iniciar um programa
- # programa: c:\windows\system32\wscript.exe
- # argumentos: "c:\program files\openssh-win64\sshd.vbs"
- # condições
- # desmarcar tudo
- # configurações
- # desmarcar tudo
- # se a tarefa já estiver sendo executada: não iniciar nova instância
- #
- # >>serviço<< (erro ao inicializar)
- sc create wsl_sshd DisplayName= "WSL SSHd" start= auto binpath= "c:\windows\system32\bash.exe -c \"sudo /usr/sbin/sshd -D\""
- sc create wsl_sshd DisplayName= "WSL SSHd" start= auto binpath= "c:\windows\system32\wscript.exe \"c:\program files\openssh-win64\sshd.vbs\""
- sc delete wsl_sshd
- #
- # >>wabash<<
- # <http://github.com/cerebrate/wabash>
- choco install --reinstall -f wabash
- refreshenv
- where wabash
- bash -l
- sudo -i
- echo 'deb https://cerebrate.github.io/wsl-translinux/ xenial main' >| /etc/apt/sources.list.d/wsl-translinux.list
- apt --allow-unauthenticated update
- apt --allow-unauthenticated -y install wabashd
- visudo
- # ALL ALL=(root) NOPASSWD: /usr/sbin/service
- vi /mnt/c/ProgramData/chocolatey/lib/wabash/tools/Wabash.exe.config
- # <string>ssh</string>
- exit
- exit
- wabash
- bash -c 'vi /mnt/c/ProgramData/chocolatey/lib/wabash/tools/Wabash.exe.config'
- # >> chocolatey <<
- # <http://chocolatey.org/install>
- iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
- # >> win32-openssh <<
- # running bash from ssh (using built-in SSH Server Broker/Proxy) causes error 0x8007048f <http://github.com/Microsoft/BashOnWindows/issues/777>
- # <http://github.com/PowerShell/Win32-OpenSSH/releases>
- # <http://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH>
- # <http://github.com/PowerShell/Win32-OpenSSH/wiki/Troubleshooting-Steps>
- # <http://github.com/PowerShell/Win32-OpenSSH/wiki/Security-protection-of-various-files-in-win32-openssh>
- # <http://chocolatey.org/packages/openssh>
- # <http://winscp.net/eng/docs/guide_windows_openssh_server>
- vi C:/Program Files/OpenSSH/sshd_config
- # Port 22
- # ListenAddress 0.0.0.0
- # PermitRootLogin yes
- # PasswordAuthentication yes
- # ChallengeResponseAuthentication yes
- # X11Forwarding yes
- # UsePrivilegeSeparation no
- # PidFile "C:/Program Files/OpenSSH/logs/sshd.pid"
- # KbdInteractiveAuthentication yes
- # ForceCommand powershell.exe
- ssh-keygen -A
- # cmd
- sc query sshd
- sc start sshd
- sc stop sshd
- # >> chocolatey openssh <<
- # <http://chocolatey.org/packages/openssh>
- # <http://github.com/DarwinJS/ChocoPackages/blob/master/openssh/readme.md>
- choco upgrade openssh
- # new prompt:
- refreshenv
- # Get-ExecutionPolicy -List
- # Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
- # iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
- # choco install win32-openssh
- # cd 'C:\Program Files\OpenSSH-Win64\'
- # install-sshd.ps1
- # ssh-keygen -A
- # New-NetFirewallRule -Protocol TCP -LocalPort 22 -Direction Inbound -Action Allow -DisplayName SSH
- # install-sshlsa.ps1
- # Control Panel > System and Security > Administrative Tools > Services > SSHD > Action > Properties > Startup Type > Automatic > Confirm > Start
- # setar senha do usuário 'administrador'
- # ssh localhost
Add Comment
Please, Sign In to add comment