Can't change User Manager User profile through Terminal? - terminal

I am trying to change the User Manager User account profile from terminal but it seems like I can't so how exactly to change the profile from Terminal..!
Why I can't do this???
[admin#TP-Link] > tool user-manager
[admin#TP-Link] /tool user-manager> user
[admin#TP-Link] /tool user-manager user> set [find username=home] profile="1 Mbps"
expected end of command (line 1 column 26)
[admin#TP-Link] /tool user-manager user>
I have even tried with it as :
[admin#TP-Link] > /tool user-manager user
[admin#TP-Link] /tool user-manager user> set [find username=home] actual-profile="2 Mbps"
expected end of command (line 1 column 26)
Since the profile is stored as in value on print :
[admin#TP-Link] /tool user-manager user> print
Flags: X - disabled, A - active, I - incomplete
0 customer=admin actual-profile="1 Mbps" username="home"
password="home1234" shared-users=1 wireless-psk="" wireless-enc-key=""
wireless-enc-algo=none
uptime-used=1w6h9m28s download-used=9836712280 upload-used=465715361 last-seen=feb/18/2017 07:51:03
Here is a screenshot too :

/tool user-manager user create-and-activate-profile [find username="hone"] customer=admin profile="1 Mbps"

Related

Netmiko ConnectHandler - for device with custom login prompt

I have few Linux devices that is setup with customized login prompt which uses 5 parameters (username, password, Accountname, Userid, Userpassword)
As far i'm aware Netmiko ConnectHandler only has the option of Username and Password for the login/connect to a device. is there any other method that i can use in netmiko by which i can establish the ssh channel to this device?
$
$
$ssh -l support USLNXGWSVR
ACCOUNTNAME : tier1support
USERID : kevinstephan
PASSWORD: *********
Password: *********
[support#USLNXGWSVR~]$
[support#USLNXGWSVR~]$
[support#USLNXGWSVR~]$ uptime
00:19:44 up 117 days, 19:09, 1 user, load average: 0.00, 0.01, 0.05
[support#USLNXGWSVR~]$

Can you not combine a variable with a string to look up another variable?

I have a script that I'm creating to create new users and add publickeys when I boot up a new node. However I'm running into issues when trying to pull from (user)_PUBLIC_KEYS array.
#!/bin/sh
USERS=(
User1
User2
)
User1_PUBLIC_KEYS=(
"ssh-rsa ..."
"ssh-rsa ..."
)
User2_PUBLIC_KEYS=(
"ssh-rsa ..."
)
for user in "${USERS}"; do
USERNAME="${user}"
...
# Add provided public keys
for key in "${USER}_PUBLIC_KEYS[#]"; do
echo "${key}" >> "${home_directory}/.ssh/authorized_keys"
done
...
done
I've even tried testing
user+="_PUBLIC_KEYS[#]"
# Add provided public keys
for key in "${user}"; do
echo "${key}"
done
This results in
User1
User1_PUBLIC_KEYS[#]
User2
User2_PUBLIC_KEYS[#]

Ansible - User input

If a user is prompted for some input and in this case they don't input anything and just press enter a " '' " value is put into the variable:
Example of the question:
- name: "vs_rule"
prompt: "enter the associated rule [Press enter to skip or enter in the following format: rule1 rule2]"
private: no
I'd like to use something similar to the below code but I don't want to pass the quotes onto the LTM (''), since the user will see the following error: "std exception: (basic_string::substr), exiting..."
Is there a way to filter the '' after the else and just send nothing to the LTM?
- "{{ 'tmsh list ltm rule ' + vs_rule + '' if vs_rule else '' |default([]) }}"
According to the vars_prompt documentation (here), you can add a default value for your variable, in the case the user does not enter any content.
On your case you could pass an empty string:
- name: "vs_rule"
prompt: "enter the associated rule [Press enter to skip or enter in the following format: rule1 rule2]"
private: no
default: ""
and the remaining "code" will work

Prompt during Chef provision

Part of a Chef cookbook I'm writing is configuring perforce, which requires the user to enter their password (lest they save this in plaintext in an "attributes" file). Is it possible to interrupt the provisioning with an interactive prompt?
We would prompt the user from the Vagrantfile and then set that value as a Chef attribute. Prompts really only makes sense on dev boxes, so they really shouldn't be part of the Chef recipe:
Vagrant.configure('2') do |config|
config.vm.provision :chef_client do |chef|
chef.add_role 'dev'
chef.chef_server_url = 'https://api.opscode.com/organizations/myorg'
chef.node_name = "vagrant-#{ENV['USER']}-dev.example.com"
chef.validation_key_path = 'example-validator'
chef.json = {
'mysvc' => {
'password' => MySvc.password()
}
}
end
end
module MySvc
def self.password
begin
system 'stty -echo'
print 'MySvc Password: '
; pass = $stdin.gets.chomp; puts "\n"
ensure
system 'stty echo'
end
pass
end
end
Correct me if i misunderstood your problem, if you want to read user input :
You can use built-in SHELL command "read".
example:
[myprompt]$ read -p "Insert text : " IN_TEXT
Insert text : user input
[myprompt]$ echo $IN_TEXT
user input
ps: if you use read command for password you can use "-s" option to hide input coming from terminal.
example2 :
[myprompt]$ read -sp "Insert text : " IN_TEXT
Insert text : //stdin <<"user input"
[myprompt]$ echo $IN_TEXT
user input

How to check if WEP authetication is failed in linux

If using the WEP security in open mode, then how can client running Linux kernel can check that Authentication is failed because of wrong key, but association was successful because it's an WEP open mode.
You will see this in wpa_supplican's log. It will look somehow like this (sorry, just random example I found in Internet):
[ 778.327092] wlan0: associated
[ 778.332503] ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[ 788.334222] wlan0: disassociating from 00:1c:f0:b1:80:6a by local choice (reason=3)
[ 788.341433] cfg80211: Calling CRDA for country: US
[ 788.342348] wlan0: deauthenticating from 00:1c:f0:b1:80:6a by local choice (reason=3)
[ 789.122029] wlan0: no IPv6 routers present
[ 789.263341] wlan0: authenticate with 00:1c:f0:b1:80:6a (try 1)
[ 789.463049] wlan0: authenticate with 00:1c:f0:b1:80:6a (try 2)
[ 789.663048] wlan0: authenticate with 00:1c:f0:b1:80:6a (try 3)
[ 789.863057] wlan0: authentication with 00:1c:f0:b1:80:6a timed out
As you could see from the log above, client has been successfully associated (778.327092), but failed on the authentication stage (789.863057).
You could also use *wpa_cli* and its 'status' command:
> status
bssid=00:1c:f0:b1:80:6a
ssid=KLUK2
id=1
mode=station
pairwise_cipher=NONE
group_cipher=NONE
key_mgmt=IEEE 802.1X (no WPA)
wpa_state=ASSOCIATED
Supplicant PAE state=CONNECTING
suppPortStatus=Unauthorized
EAP state=IDLE
<2>Authentication with 00:1c:f0:b1:80:6a timed out.
> <2>CTRL-EVENT-DISCONNECTED bssid=00:00:00:00:00:00 reason=3
> <2>CTRL-EVENT-DISCONNECTED bssid=00:00:00:00:00:00 reason=3
> <2>CTRL-EVENT-SCAN-RESULTS
> <2>Trying to authenticate with 00:1c:f0:b1:80:6a (SSID='KLUK2' freq=2437 MHz)
<2>CTRL-EVENT-SCAN-RESULTS
<2>CTRL-EVENT-BSS-REMOVED 0 00:1d:19:cd:43:a1
> <2>CTRL-EVENT-BSS-REMOVED 1 00:24:fe:82:ea:d9
> <2>CTRL-EVENT-BSS-REMOVED 2 00:04:0e:8e:a7:fe
> <2>CTRL-EVENT-SCAN-RESULTS

Resources