#StackBounty: #bash #command-line #kill #interrupt Interrupt shell command line expansion

Bounty: 50

Warning: DO NOT attempt the commands listed in this question without knowing their implications.

Sorry if this is a duplicate. I am surprised to learn that a command as simple as

echo $(yes)

freezes my computer (actually it is lagging the computer very badly rather than freezing, but the lag is bad enough to make one think it has frozen). Typing CtrlC or CtrlZ right after typing this command does not seem to help me recover from this mistyped command.

On the other hand

ls /*/../*/../*/../*/../*/

is a well-known vulnerability that also lags the computer badly to the best and crashes the computer to the worst.

Note that these commands are quite different from the well-known fork bombs.

My question is: Is there a way to interrupt such commands which build up huge amount of shell command line options immediately after I start to execute them in the shell?

My understanding is that since shell expansion is done before the command is executed, the usual way to interrupt a command does not work because the command is not even running when the lag happens, but I also want to confirm that my understanding is correct, and I am extremely interested to learn any way to cancel the shell expansion before it uses too much memory.

I am not looking for how the kernel works at low memory. I am also not looking for SysRq overkills that may be helpful when the system already lags terribly. Nor am I looking for preventative approaches like imposing a ulimit on memory. I am looking for a way that can effectively cancel a huge shell expansion process from within the shell itself before it lags the system. I don’t know whether it is possible. If it is impossible as commented, please also leave an answer indicating that, preferably with explanations.

I have chosen not to include any system-specific information in the original question because I want a general answer, but in case this matters, here are the information about my system: Ubuntu 16.04.4 LTS with gnome-terminal and bash 4.3.48(1), running a x86_64 system. No virtual machines involved.


Get this bounty!!!

#StackBounty: #16.04 #command-line #vpn Command line connect to L2TP Windows Server VPN

Bounty: 50

I have been searching for a couple of days not much luck as and everything i come across relies on using the Network Manager UI.

Could someone provide me with a noobish tutorial on how I would configure the ubuntu server to automatically (on startup) connect to an L2TP over IPSec VPN with Windows Login credentials?

It does not have to be L2TP over IPSec, I do also have the Windows Server configured to allow PPTP VPN connections but I would prefer L2TP as it’s more secure.

I would also need to know if there is a special configuration I need to prevent the Internet connection being tunneled through the VPN as I know windows does this by default and it has to be turned off on the VPN Network Adapter in windows if the same need to happen on the Ubuntu server I will need to know how to do that so I don’t lock myself out of the server by it losing its internet connection 😀

The reason for this is that I have quite a lot of attempts on the SSH Port’s so I want to set the Hardware Firewall in front of the server to not allow SSH through it and make it so the only way to connect to the SSH server is via the Corporate VPN.


Get this bounty!!!

#StackBounty: #linux #command-line #bash #shell #shell-script How can I get bash command line completion to complete a partial argument…

Bounty: 50

Imagine I have a command ‘command’ which takes arguments foo:bar foo:foo bar:bar or bar:foo
I can write a command line completion script that I can source into my environment to give me completion that looks like the following:

function _command_opt()
{
    local cur prev opts
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"
    opts="foo:bar foo:foo bar:bar bar:foo"
    if [[ ${prev: -7} == 'command' ]]
    then
        COMPREPLY=( $(compgen -W "${opts}"  -- ${cur}) );
        return 0;
    fi
}
complete -F _command_opt -o bashdefault -o default 'command'

However if I type command f[tab][tab] I get foo:bar and foo:foo listed, but neither is completed onto my command line (because they aren’t yet distinct. What I would like to accomplish is that this produces command foo: and leaves my cursor at the end of the current word (rather than adding a space) to allow me to then type b or f and then tab again to finish the command. The example problem is just to show what I mean… the real case the prefix:suffix combinations are quite long, so partial completion would be really beneficial. e.g. 25 different commands that all begin with prefix translationupdateprocess: and translationupdateprocess is one of 25 different equally long prefixs with that many options.

Does anyone know of a way to get bash complete to operate this way?


Get this bounty!!!

#StackBounty: #windows #command-line #cmd.exe #colors cmd.exe highlight background color

Bounty: 50

When you highlight text with the Command Prompt (cmd.exe), it just inverts the
colors of whatever you selected:

white

However the white is a little bright for me, I would prefer gray background. I
changed what I think is the right setting, “Popup Background” under
“Selected Popup Colors”:

background

However the change seems to have no effect. Can I change the white highlight
color, if so how, and if not via the “Popup” setting then what is the “Popup”
setting for?


Get this bounty!!!

#StackBounty: #windows #windows-10 #command-line #bluetooth Turn on/off Bluetooth radio/adapter from cmd/powershell in Windows 10

Bounty: 100

Such a simple task, one would say, and I haven’t found a satisfiable solution. What I’ve tried (with music playing through a Bluetooth-connected speaker to really know the state of the radio):

  • using devcon as admin: devcon disable USBVID_8087&PID_07DC&REV_0001 (which is the HW ID of my Bluetooth adapter)… requires reboot to work…
  • using powershell as admin: Disable-NetAdapter "Bluetooth Network Connection 3" (which is translation of the name of my Bluetooth adapter)… it disables the PAN driver, but a Bluetooth speaker continues playing music…
  • using net as admin: net stop bthserv… doesn’t actually turn off the radio (BT speaker continues playing music)
  • using .NET: The most relevant page on MSDN doesn’t say a word about turning the adapter on/off.
  • using explorer: ms-settings:bluetooth or explorer.exe %LocalAppData%Packageswindows.immersivecontrolpanel_cw5n1h2txyewyLocalStateIndexedSettingscs-CZAAA_SettingsPagePCSystemBluetooth.settingcontent-ms… opens the Bluetooth settings panel, but I still have to click on the toggle

I can’t believe Microsoft would be so ignorant to not provide such a command…


Get this bounty!!!

#StackBounty: #command-line #permissions #directory Recursively change owner of a directory by that directory's name

Bounty: 100

In Ubuntu 16.04 I have a few website directories under /var/www/html/.

I desire that the owner of each dir will be identical to the dir’s name.

How could I recursively change the owner of a dir by that dir’s name?

Notes:

1) I’ve already created a user per each directory as in:

useradd ${domain} --gecos --disabled-password --disabled-login

2) The purpose of this operation is of security reasons – to prevent all dirs to have the same owner.


Get this bounty!!!

#StackBounty: #command-line #keyboard #python3 #readline Using readline in python3 (input) pressing arrows will remove text from the in…

Bounty: 50

My input code is:

import readline
readline.parse_and_bind('tab: complete')
readline.parse_and_bind('set editing-mode vi')

while True:
     c = input('INPUT> ')

(It is a little piece of test code to test readline.)

When i type abc ENTER Hello, World! ENTER and 2x arrow up instead of

INPUT>abc

It is INabc

Does anyone know how to fix this?

(I already tried commenting out the readline.parse_and_bind’s I also use updated python3 and updated my readline using pip3, which also it up to date. And my readline is for python3. And everything is up to date!)


Get this bounty!!!

#StackBounty: #windows #command-line #filesystems #ntfs #fuse Windows cli equivalent of Mac `xattr`?

Bounty: 100

I thought extended file attributes existed in NTFS which Windows supports. I cannot find a cmd for accessing/updating attributes.

Is there a flavor of Windows (and its file system) that supports this?

I tried getfattr, setfattr, and a number of other commands. attrib is not it either.

If extended attributes are to remain portable across filesystems (even virtual ones implemented in FUSE) then all target platforms need to present an api in userspace (a cmd or set of cmds).


Get this bounty!!!

#StackBounty: #linux #command-line #voip #raspberry-pi #lan Terminal-based VoIP over LAN on Linux

Bounty: 100

I’m looking for a way to do voice chatting over my LAN without an Internet connection. The two machines both run Linux (they are Raspberry Pis, with the latest Raspbian Stretch Lite installed).

Programs like Skype won’t do the job, because they require an Internet connection and only run with a GUI. TeamSpeak would probably run without an Internet connection, but I don’t think that there is a way to start it without a desktop environment.

Do you know a program that would meet these requirements? Preferably an open source solution?


Get this bounty!!!