You are Here:
Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section



tutorial/installing bash in Windows 10/ using rdp and samba and bash altogether

Author (Read 4943 times)

0 Members and 1 Guest are viewing this topic.

tutorial/installing bash in Windows 10/ using rdp and samba and bash altogether
« Reply #1 on: September 14, 2016, 02:24:55 PM »
 

trinidad

  • Platinum Level Poster
  • **********
  • 1463
    Posts
  • Reputation: 212
  • Linux Lite Member
    • View Profile
    • dbts-analytics.com

  • CPU: i7 4 cores 8 threads

  • MEMORY: 16Gb

  • VIDEO CARD: Intel HD graphics

  • Kernel: 5.x
          As you are probably aware by now, Windows 10 now includes an optional Linux sub-system to run an Ubuntu based bash shell. The feature was not available on early Windows 10 HE builds, but is available on all Windows 10 builds after this summer’s anniversary update. It is not too difficult to install, but it can take some time to fully configure itself within Windows. Typically MS development stuff downloads in intermittent chunks, often with long lags between, so it may be easiest to just leave your computer on over night. I was an early user of this feature, and the configuration and registry tweaks spent more time updating than anything else for the first week or so, but now the process is a little quicker, though the changes seem to be picking up again as developers get deeper and deeper into enabling new features. Just be patient after agreeing to the system changes in the Bash shell at first. It can take quite a while before the command line returns the first time. I don’t follow the developer blog much myself, finding it to be mostly an annoying labyrinth of complaining, and bad praxis. I don’t recommend playing with the developer option to get the bash shell, unless you know how to secure your Windows 10 computer properly, or run your connection through a secure server first, as developer mode can add a few more vulnerabilities to your Windows 10 computer, and the typical MS GUI redundancy makes it tedious to switch the settings back and forth.
 
          Clicker cautionary tales aside, once running, the bash shell itself is fairly powerful, and can be tweaked quite a bit, even run simple X11 GUIs by pointing it at an external X server, if you know what you’re doing. Any Ubuntu software you attempt to run is limited by Linux system calls that exceed those already transposed into Windows system calls by the sub-system. Importantly missing are chroot functions, and decent X functionality. An awful lot of software will still work with it, but any software that contains initramfs calls will pretty much ruin the whole sub-system installation unless in some simpler cases the call is edited out, which means downloading the package on another Linux system first. Open SSH server will work, but without user privilege separation because of the missing chroot functionality, but it is also one of the applications that will be destroyed by downloading any other software with initramfs calls. The biggest caveat of the whole thing is that the sub-system is still proprietary and cannot be built upon without MS authentication.

          Developers reactions are mixed at best, most coming from a Cygwin and Linux virtual system terminal trading praxis, holding out hope that their projects could be simplified by the new bash shell. As for me and the kind of rare coding I occasionally do, and you heard this first here, I honestly think that MS only put this into Windows to allow network administrators access to a few important Linux commands from their Windows machines without running Linux virtual server instances. I doubt that this MS fundamental purpose will ever be exceeded to any meaningful degree. Given their business model, I think they’re just protecting their right to invade the privacy of MS users, and collect information previously unavailable to them. There is some hope that the EU will force a different version upon MS, but political things in enterprise/consumer relationship rights are always slow moving, and MS could just refuse to include it in EU versions to resolve the issue. 

          All my cynicism aside, I like the fact that the new bash shell in Windows 10 can be called and worked with directly from a Windows 10 remote desktop running on a Linux computer, though there are caveats anyone using it this way should be aware of. Importantly you should think of the whole thing more like a old Windows 3.2 system and you’ll get a sense of the risky topology that sometimes is created in your Windows system with the new bash shell. Remember why you never ran some DOS games as a Windows administrator back then. You can change and even break parts of your Windows system with bash, because it can access Windows files system wide. I’ve tested this myself, and you need to be rather careful with remove commands from the bash shell. You can easily remove parts of your Windows system by accident.

*Installing Ubuntu Bash In Windows 10
 
          Logged into Windows as an administrator with your computer connected to the Internet, click >Start>Settings>Update And Security and select >For developers in the left pane. In the right pane click >Developer mode. Exit settings and next click >Start>All Apps> scroll to and click on >Windows System, then scroll to and click on >Control Panel. Click >Programs, then in the right pane of the window that appears, listed under the heading Programs And Features locate and click on >Turn Windows Features On Or Off. Then in the smaller Windows Features window that appears, scroll and locate and check the box next to >Windows Subsystem For Linux (Beta). Click the >OK button to the lower right of the window. You will be prompted to restart your computer. Accept, and click >Restart Now.

          After your computer restarts, log in as an administrator again, preferably the account we have been using all along in our Linux Lite power networking tutorials, and click >Start>All Apps>Windows System>Command Prompt, and type the following command carefully: lxrun /install /y and hit>enter and bash will install with a passwordless root prompt. Otherwise click >Start and type bash and click on the bash entry that appears in the menu. Bash will appear and you’ll be prompted to accept the terms of service. Type y and hit >enter, and your download will begin. You will eventually be prompted to create a user name and password for bash. In my experience the second method here, though you wouldn’t think it should, took considerably longer than the first, on one computer hanging several times as the subsystem was created, and not returning the command prompt for quite a while, actually a few days or so, and several restarts. It’s a good idea to run any hanging Windows 10 updates you may have before attempting to install bash with the second method described here, or you may wait a day, or more for it to set up and install, especially if you are regularly using the computer you are trying to install to in the meantime. It’s also a good idea to have your Windows 10 system on at least a 250gig partition if you expect it to have any decent longevity of future service.

          Once your new bash shell has loaded with the command line, which should read like this: root@localhost:/mnt/c/WINDOWS/system32# you can log out and restart your computer again, logging back in again as the administrator account we have used in our previous tutorials. Click >Start and type bash, and click on >Bash from the menu that appears, and your bash shell will appear with its command prompt. Type into the shell at the prompt, and run: apt-get update. Repository updates will load. Nano and Ubuntu/vi stubs are on already on board your bash version, but can be updated if you like though there is rarely anything there. If you like just enter apt-get install nano, and any updates will load. You can add PPAs and git as well if you like. 

          If you installed your bash using the faster first method above, or if you want to add any other new users to bash type in the command: adduser newusername  i/e, whatever user name you like, but it will be easier if you want to set up SSH in your new bash to use your Linux Lite sudo user name and password as we have been doing all along. A dialogue will appear prompting you to create a password. Then annoyingly a dialogue will appear asking for user information, which you thankfully can leave blank, just hit >enter, and your new user and password will be created. To make the user a sudo user the new Ubuntu/Windows way you will have to use the visudo command. Enter the command visudo and the user privileges file will appear. Do not attempt to do this any other way, i/e the new Debian way, or you’ll make a mess. Add your new user below the root user with the privileges ALL=(ALL:ALL) ALL if you want sudo, and your new user will have sudo privileges. Hit control+x, then y, then hit >enter to save changes.

          Now to set your new user as the default (the one that appears in the bash command line) you will have to open the Windows command prompt. Type exit into your bash shell and hit >enter to close it. Next click >Start >All Apps>Windows System>Command Prompt and a Windows terminal will open.  Now enter the command at the Windows command prompt: lxrun /setdefaultuser newusername. Windows will locate the user we created earlier in bash calling it a UNIX user with a UNIX password. Follow the dialogue agreeing where appropriate, and Windows will install your new sudo user as the default user in your bash shell command line.

          Now click >Start again and type bash clicking on >bash when it appears in the search menu, and bash will open again. Position the two terminals next to each other, so you can work from both, and this will give you an aesthetic sense of how this system actually works. It is a Windows system, using Windows system calls to emulate Linux system calls. Remember this if you do manage to mess up your new bash, because to remove it and re-install it you will need to use the Windows command line not the bash command line. Your new bash command line should now read differently. The # should now be replaced with the $ indicating you are not root, i/e, newsusername@localhost: followed by /mnt/c/WINDOWS/system32$  Now you will have to enter the sudo prefix and be prompted for a password to make changes. You now have a working bash shell in Windows 10 with a sudo user.

          Okay. If you have been following our power local area private networking tutorials, we have already installed Double Commander to our Windows 10 box, and to our Linux Lite box, and enabled samba and remote desktop protocol between our Windows 10 and Linux Lite computers with full administrator privileges in Windows 10. Make sure both computers are connected to the Internet and open Thunar on your Linux Lite computer, and backspace out the URI address line entering smb://192.168.0.5 (the same IP for your Windows 10 computer that we used for your remote desktop connection) Hit >enter and then backspace out your samba user name, replacing it with the Windows administrator account we used before, leaving HomeGroup as is, and entering that account’s password. Click on >Users from the files that appear, and repeat the routine as above for account and password. Select the user name that matches our administrator account and the Windows file system will appear. Close Thunar leaving the Windows drive mounted, and open Double Commander.

          After Double Commander opens select >gvfs in the right hand pane and click on the directory line that reads something like samba share server with your Windows computer IPv4 address i/e 192.168.0.5. From the directories that appear click on the Windows administrator account user name we have been using all along. From the directories that appear click >AppData. From the directories that appear click >Local. From the directories that appear click >lxss. Familiar looking Linux directories will then appear. Now click on >rtfs and a familiar Linux root file system will appear, with whatever actual Linux files exist in your bash setup on Windows 10, but remember, this will be a very small file system, not a full Linux kernel installation, as the Windows kernel emulates the Linux kernel.

          Okay. Now on another desktop just for convenience sake go ahead and open Remmina and enable our Windows 10 to Linux Lite remote desktop. Give it a minute or two to resolve the dual connection. Now go ahead and click >Start, type in bash, and click on >bash when it appears in the search menu, and your bash shell in Windows 10, on its remote desktop in Linux Lite will load. Now click >Start>AllApps>Windows System>Command Prompt, and your Windows 10 command terminal will load to your remote desktop. The power is there. The rest is up to your imagination.

          Humorously I expect most Windows 10 bash users to make mistakes with updates and/or upgrades as it seems the software repositories Windows 10 uses from Canonical do not yet make distinctions concerning initramfs system calls. Unfortunately once installed this usually messes up other software functionality in Windows 10 bash causing an Ubuntu call that cannot be gotten rid of easily. It’s simpler given the proprietary nature of the underlying system call emulation beast to uninstall and reinstall bash. If you’ve wrecked your bash in Windows 10 click >Start>AllApps>Windows System>Command Prompt and at the prompt enter:  lxrun /uninstall /y  This command will not remove the home folder from the system containing preferences and saved files. To remove your bash home folder too enter the command:  lxrun /uninstall /y /full and bash will be completely removed. To reinstall bash just use the command we used initially lxrun /install /y 

          *Read This Note. I initially scanned my home network with nmap after installing bash to Windows 10 with root without password as above, and developer mode enabled. Nmap did not return the Ipv4 address for the little woman’s Windows 10 box where bash now resides. I rescanned the Ipv4 address (which by the way still worked for samba and remote desktop) directly for ports and OS and the result returned ping refused. Apparently adding bash in this fashion (no root password), or enabling developer mode automatically enables IPv6 addressing, if your router conforms to the protocol, which makes sense if one is going to use a root terminal with no password. For those of you who wish to set up SSH in the Windows 10 bash shell this is something to consider, along with the missing chroot functionality. Make sure SSH and SSL are allowed through your Windows firewall. They are listed with check boxes. Click on >Start>Settings>Network And Internet and in the lower right pane click >Windows Firewall. In the window that appears, in the upper left pane click >Allow an app or feature through Windows Firewall. In the next window that appears click the >Change settings button and scroll down to SSH and SSL and check the boxes to allow the protocol through the Windows firewall.

TC
All opinions expressed and all advice given by Trinidad Cruz on this forum are his responsibility alone and do not necessarily reflect the views or methods of the developers of Linux Lite. He is a citizen of the United States where it is acceptable to occasionally be uninformed and inept as long as you pay your taxes.
 

 

-->
X Close Ad

Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section