General :: How To Get Invalid User Input Into Variable?
Apr 8, 2010
I have a script in which it searches the password file for a username based on the user's input. Is there a way I can take the bad input and keep it in a variable. (one that keeps adding all the non-existent users)so how would I get non-existent users into another variable?
View 9 Replies
ADVERTISEMENT
Mar 16, 2010
I have a BASH script which at one point asks the user a yes/no question. I want to make it so that if the user types in an invalid input 3 times consecutively then the BASH script will echo an error and terminate with exit status 1.
View 9 Replies
View Related
Sep 25, 2009
I'm sure you all seen how you can use curl to post to you twitter acct. What I'm wondering is how to add a variable to take user input and post that imput.
Code:
#!/usr/bin/perl
"Enter tweet: ";
$msg = <STDIN>;
[Code]...
View 3 Replies
View Related
May 3, 2011
I'm trying to call a specific variable based on a user selection. For example:
Code: Select a file:
[1] foo.tar
[2] bar.tar
Enter a selection: I have already coded each possible selection to have its own variable. If the user selects 2 I need to select $SELECTED_TAR2, or if they select 1 I need to select $SELECTED_TAR1 and then do something like this behind the scenes:
Code: cp /home/user/$SELECTED_TAR2 /home/user/backup/$SELECTED_TAR2
I was thinking something like this:
Code: echo "Enter a selection: "
read -e SELECTED_NUMBER
cp /home/user/$SELECTED_TAR$SELECTED_NUMBER /home/user/backup
[code]....
View 2 Replies
View Related
Feb 10, 2011
Trying simply to insert into table. Have succeeded in doing this but now want to correct user use of invalid characters. If I'm understanding correctly, Real-escape-string seems to correct these, so I've been trying to figure out how to use it. A short, test code version gives me a syntax error at INSERT VALUES, which--because it still has the single quotes in the text--tells me the real-escape-string didn't work. The code below gives me a parseing error with invalid $END at </body>.
Insert Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' VALUES (UTC_TIMESTAMP,'What's happen' bra?')' at line 1 Parse error: syntax error, unexpected $end in /home/powere15/public_html/DB/exercises_insert_record.php on line 94
<html><head><title>Exercise Catalog Insert Record</title></head>
<body>
<?
/* Change db and connect values if using online */
[Code]....
View 2 Replies
View Related
Aug 22, 2010
I'm basically setting up two sshfs mounts and I have it set up so I run one command but type my password twice.Is there an easy to way to input a password using bash and pass that variable to another process asking for a password?
View 5 Replies
View Related
Feb 3, 2010
I need to create a single line of output from multiple and variable lines of input in a Linux bash shell script.
My input file looks like this:
Where there may be any number of umsecondaryphonenumber lines; if there is not a umsecondaryphonenumber line for a telephonenumber, I don't want to write any output.
So, the output file should look like:
The script I have so far is:
My question is - how do print each of the elements of an array in one record - i.e. what do I put in place of howdoiprintarray?
View 2 Replies
View Related
Nov 5, 2009
I have a section of a script that is supposed to change the filename of similar files in a directory. It works the way I need it to work, except that I would like to input the new filename each time it runs without having to edit the script.
I capture 5-6 images into ~/screenshots. They are labeled Picture 1.png, Picture 2.png, etc. I would like to be able to rename them as Lesson 1.png, Lesson 2.png, and so forth. It works if I hardcode the new NAME (Lesson) into the script, but I want to replace NAME with a variable that I can input at a prompt or pass into the script from another. I have tried setting a variable and replacing "Lesson" with $variable in line #11, but that leaves me with only the extension and no filename.
I have also tried using $1 on the command line:
Here is what I have that works:
How do I get a variable into this script?
View 2 Replies
View Related
Jan 28, 2010
I heard (although I can't find any sources for proof) that the USER environment variable may not be set in a old Unix shells (maybe even some obscure shells as well). What is the probability that it won't be set?
View 2 Replies
View Related
Feb 2, 2011
right now i am writing bash script for simple everyday todo tasks.script consisit of two files, fisrt is just script (which can delete/append /clear) and second one is todolist.txt which stores my notes.I am litlebit confused about sed!!for example, If my todolist.txt have these lines:
- Writing my Homework
- take my girlfriend to launch
- Take a break
How can sed take my input $@ and delete all line with name "Homework"..i trayed with many sed combination like:
Code:
sed s/$@//g
sed 'd/$@/'
and many more combination with ""/'' or bracket but nothing helped
View 5 Replies
View Related
Dec 2, 2010
I want ssh a remote server through shell script with predefines username and passwd. i dont know how to use expect command to do that.
View 4 Replies
View Related
Aug 27, 2010
How can I to pass a perl variable into html input tag? For example, If a have got a cgi script:
Quote:
use CGI;
use DBI;
my $owner = $cgi->param('owner');
[code]....
How can I to pass $owner variable?
View 1 Replies
View Related
Jul 21, 2010
I'm trying to write a small script that will run as root, but launch a command with sudo as another user. I want that user to be whichever user is active user. That is, the user that is using GDM right now, or the one that is logged into the current console. (by current console, I don't mean the user running the script, but rather the user logged into the console currently displayed on the screen.)How can this be done?
Code:
ACTIVE_USER=`somecommand`
test `id -u pulse` -ge 1000 && sudo -u $ACTIVE_USER $*
What can I use for "somecommand"?
View 5 Replies
View Related
Dec 4, 2010
I'm trying to create a backup script. For my second version, I want to make a GUI that will ask the user three things:
1. which folders should be excluded
2. where to store the backup
3. the user's email
I need to store this input, and later input the values into variables in my script. How do I go about doings this?
View 1 Replies
View Related
May 5, 2011
I have a program that I run from the terminal that requires manual input (it's matlab in mex debugging mode, matlab -Dgdb, which starts the GNU C debugger with its own custom settings).
Every time I run this program I always type in the same few commands in the program's interactive shell before I actually start working (for example: run -nojvm; stop at mexFunction; continue). I want to avoid typing these commands and I thought I could do this with shell scripting, saving the commands in the mycommands file, then running: myprogram < mycommands
The problem is that this runs all the commands and then exits the program. I want it to run the commands and return control to me so I can run my commands. Is there a way to tell the shell to use a file or a string as the input to a program then immediately return control to the user without the exiting the program?
View 3 Replies
View Related
Jan 18, 2010
Execute putty to start a script on a remote linux server which requires user input The remote script does a read -p "Please enter name" NAME I can use plink to execute a script over SSH, the following attempts and problems are shown below :- Note the -load ns is to load a session that doesnt exist, ie ensure no defaults are used
1) plink.exe -load ns <ip_addr> -l <user> -pw <password> <script path/name> Problem) Doesn't allow/show user input, ie its non-interactive.
2) Add -t to allocate a pty :- plink.exe -t -load nc <ip_addr> -l <user> -pw <password> <script path/name> so now the user input can be seen, but I get Ctrl+H (^H) when backspace is pressed, ok if the user doesnt make a mistake!
3) Use putty instead with a saved session putty.exe -load "SavedSession" Get a new window opened, not a biggy, but not as nice. (b) saved session cannot be easily moved. (c) Get password prompt, cannot provide password like with plink, I know I know, use keys, but this is a closed, private network, and its easier not to bother with keys!I would like the SSH to execute in-line, that is from within the batch file/command line shell I am in, not prompt for username/password, run the linux script and allow prompts and delete/backspace to work.
View 5 Replies
View Related
Nov 28, 2010
I am new to writing shell scripts. So, please bare with me. I am currently trying to write a shell script which will read the directory path as input from user and will traverse the Dir tree to find all available audio and video files. I have tried to write as much as I could but I don't know where I am making mistake as I get some files to be audio file which are actully tar balls. On the second note there are some files which video but script shows them to be audio. And, some video files are completely skipped. I am giving the shell script below so that you can see. I am using two external files as source which I am attaching.
Code:
#!/bin/bash
#Let's load the extensions that we want to search for
vdExt=$(cat vdExtList)
adExt=$(cat adExtList)
[code]....
View 5 Replies
View Related
Jun 27, 2011
Seemingly simple question, which yields slightly undesired results. Execute putty to start a script on a remote linux server which requires user input The remote script does a read -p "Please enter name" NAME I can use plink to execute a script over SSH, the following attempts and problems are shown below :-
Note the -load ns is to load a session that doesnt exist, ie ensure no defaults are used
1) plink.exe -load ns <ip_addr> -l <user> -pw <password> <script path/name> Problem) Doesn't allow/show user input, ie its non-interactive.
2) Add -t to allocate a pty :- plink.exe -t -load nc <ip_addr> -l <user> -pw <password> <script path/name> Problem) Ok, so now the user input can be seen, but I get Ctrl+H (^H) when backspace is pressed, ok if the user doesnt make a mistake!
3) Use putty instead with a saved session putty.exe -load "SavedSession" Problem) (a) Get a new window opened, not a biggy, but not as nice. (b) saved session cannot be easily moved. (c) Get password prompt, cannot provide password like with plink, I know I know, use keys, but this is a closed, private network, and its easier not to bother with keys!
So ideally, I would like the SSH to execute in-line, that is from within the batch file/command line shell I am in, not prompt for username/password, run the linux script and allow prompts and delete/backspace to work.
View 1 Replies
View Related
Sep 20, 2010
I installed Debian 5.03 Lenny successfully on my machine. I got this error during boot: ACPI : invalid PBLK length [5]. After that the Operating System boots properly and starts normally. What does this error statement mean? Is it safe to work with this installation despite this error?
View 1 Replies
View Related
Feb 17, 2011
how to assign a local variable value to a global variable....
View 2 Replies
View Related
Apr 16, 2011
I am supposed to create an environment variable with the PRINTER variable, which should resolve to the word sales. Would the command be like this?: env PRINTER - NAME=SALES (is this the command to create that variable with resolving the word sales to it?)
View 3 Replies
View Related
Nov 26, 2015
I just installed Debian Jessie (3.16.0-4-amd64) on a desktop box I intend to use as a server in our home office. During installation I included the web server and SSH server options. I have a user account, 'mitchell' set up in addition to root. Everything is working great except that I am unable to log in via SSH from other machines, such as a Windows desktop also on the office LAN (using PuTTY). From the PuTTY terminal it looks like the user name is accepted because the password is requested, but after entering the password it says "Access denied".
Back on the Debian box in I see:
Code: Select allNov 26 14:12:02 DebianDevP6TSE sshd[2278]: Invalid user mitchell from 192.168.1.96
Nov 26 14:12:02 DebianDevP6TSE sshd[2278]: input_userauth_request: invalid user mitchell [preauth]
Nov 26 14:12:07 DebianDevP6TSE sshd[2278]: pam_unix(sshd:auth): check pass; user unknown
Nov 26 14:12:07 DebianDevP6TSE sshd[2278]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=rmbiserv.attlocal.net
Nov 26 14:12:10 DebianDevP6TSE sshd[2278]: Failed password for invalid user mitchell from 192.168.1.96 port 60010 ssh2
So I am guessing I need to set up either the SSHD server, or maybe something in PAM, to authorized users for SSH access?
As a note, "mitchell" is the user name I use to log on to Debian, and I am entering the same user name and password when trying to log in via SSH.
If I try to log in via SSH as "root" I get the following in the log:
Code: Select allNov 26 14:17:01 DebianDevP6TSE CRON[2329]: pam_unix(cron:session): session opened for user root by (uid=0)
Nov 26 14:17:02 DebianDevP6TSE CRON[2329]: pam_unix(cron:session): session closed for user root
Nov 26 14:29:59 DebianDevP6TSE sshd[2383]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=rmbiserv.attlocal.net user=root
Nov 26 14:30:01 DebianDevP6TSE sshd[2383]: Failed password for root from 192.168.1.96 port 60132 ssh2
View 6 Replies
View Related
Dec 20, 2010
I am trying to authenticate against an LDAP server using PAM. I've gotten it asking the LDAP sever if the credentials are OK, but it still fails the authentication. In /var/log/auth.log, I get:
Code:
Dec 9 14:47:31 Linux-Test sshd[2339]: Invalid user {{user}} from ::1
Dec 9 14:47:31 Linux-Test sshd[2339]: Failed none for invalid user {{user}} from ::1 port 34571 ssh2
Dec 9 14:47:34 Linux-Test sshd[2339]: pam_unix(sshd:auth): check pass; user unknown
Dec 9 14:47:34 Linux-Test sshd[2339]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=linux-test
Dec 9 14:47:34 Linux-Test sshd[2339]: pam_winbind(sshd:auth): getting password (0x00000388)
Dec 9 14:47:34 Linux-Test sshd[2339]: pam_winbind(sshd:auth): pam_get_item returned a password
Dec 9 14:47:38 Linux-Test sshd[2339]: Failed password for invalid user {{user}} from ::1 port 34571 ssh2
Where {{user}} is the username.
View 9 Replies
View Related
Oct 21, 2010
Recently I started having this problem where most users on the system are unable to log into the system over SSH. Their user name and password is correct, however it shows them as invalid when they are in fact valid. I've tried changing their password but that didn't work. I also tried deleting their account, as well as their home directory, and then recreating the account, but that didn't work. Only root and perhaps one or two other select accounts are able to log in without problems. I even tried a reboot to see if that would fix it, but as I theorized, it wouldn't. I also checked and ensured their home directory was chowned to them, and that they even had a home directory. Any assistance would be greatly appreciated to help me get this issue resolved. As a dsie note, they are showing up as invalid in /vars/logs/auth.log. Running Debian 5.0 Lenny.
View 4 Replies
View Related
Feb 5, 2010
today i got this message everytime i try to login to yahoo messenger:"gyachi invalid user or incorrect password !" The user and password are corect, if i switch to kopete or pidgin is all right.Only with gyachi i have that problem. Using Fedora 10, gyachi improved v1.2.3
View 3 Replies
View Related
Oct 11, 2010
I have webmin and usermin setup.Iam using dovecot and sendmail ,I can use usermin to login ,check or send emails.Outlook and thunderbird works as well.
But I want to use something for webmail. I am trying squirrelmail but it keeps saying invalid user and or password.
the error log reports
dovecot: imap-login: Aborted login (auth failed)
View 4 Replies
View Related
Jan 20, 2010
I'm trying to build my own livecd using the debian live project: [URL]. At the end (/usr/lib/finish-install.d) I want the installler to change some configuration files. The custom user selected during the installation I want to put into a variable:
Code:
#!/bin/sh
User=$(getent passwd 1000 | sed -e 's/:.*//')
if [ "$User" != "user" ] ; then
in-target sed -i "s/home/user/home/$User/g" /etc/smb.conf
in-target sed -i "s/USER=user/USER=$User/g" /etc/default/sabnzbdplus
fi
The script seems to work fine because when I have a look at the configuration files the lines have been modified. However the $User was empty. Anyone of you have some knowledge about debian-live and know how to retrieve the custom user that was entered during the installation?
View 3 Replies
View Related
Jan 14, 2009
I installed the FC8.0 by hard disk! The system in (hd0,0) is windows xp! THEN i copy vmlinuz and initrd.img to c: Using GRUB like this:
title Install Fedora 8
kernel (hd0,0)/vmlinuz
initrd (hd0,0)/initrd.img
when finished to choose the keyborad the installing started but it said:
ImportError:/user/lib/libdhcp6client-0.10.so.0:Invalid ELF header
how can I continue to install?why this happens?
View 2 Replies
View Related
Mar 26, 2010
Ive just installed Debian Lenny and then fglrx and kde, but if i try to login to kde, i get an error message because of invalid user. Do I have to enable my user first to login to kde or something?
View 4 Replies
View Related
Apr 28, 2010
I've written a bash script that allows a user to input a directory location to find out the size of the directory. However, if the user inputs a directory and finds its size then inputs another directory then wants to quit, the script asks the user numerous times if he wants to quit!! The script won't exit until the number of times the user looks at a directory is reached! What gives?
Here's the script:
Code:
View 4 Replies
View Related