1

I am trying to run a script on cygwin prompt.

ssh-keygen -t rsa $email
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_rsa
mkdir -p /proj/env
ln -s /usr/bin/proj/env/bin

and running it as email="john.warnet" sh script1.sh.

But it is showing error as

  Too many arguments.
   usage: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1]
              [-N new_passphrase] [-C comment] [-f output_keyfile]
   ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
   ssh-keygen -i [-m key_format] [-f input_keyfile]
   ssh-keygen -e [-m key_format] [-f input_keyfile]
   ssh-keygen -y [-f input_keyfile]
   ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile]
   ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile]
   ssh-keygen -B [-f input_keyfile]
   ssh-keygen -D pkcs11
   ssh-keygen -F hostname [-f known_hosts_file] [-l]
   ssh-keygen -H [-f known_hosts_file]
   ssh-keygen -R hostname [-f known_hosts_file]
   ssh-keygen -r hostname [-f input_keyfile] [-g]
   ssh-keygen -G output_file [-v] [-b bits] [-M memory] [-S start_point]
   ssh-keygen -T output_file -f input_file [-v] [-a rounds] [-J num_lines]
              [-j start_line] [-K checkpt] [-W generator]
   ssh-keygen -s ca_key -I certificate_identity [-h] [-n principals]
              [-O option] [-V validity_interval] [-z serial_number] file ...
   ssh-keygen -L [-f input_keyfile]
   ssh-keygen -A
   ssh-keygen -k -f krl_file [-u] [-s ca_public] [-z version_number]
              file ...
   ssh-keygen -Q -f krl_file file ...
   Agent pid 1344
   Identity added: /home/HP/.ssh/id_rsa (/home/HP/.ssh/id_rsa)

I tried running the script by writing the command on prompt instead of copying.But couldnt find the solution.

6
  • usage: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1] [-N new_passphrase] [-C comment] [-f output_keyfile] It says you cannot pass more than 1 arguments with -t and the argument will be from these [dsa | ecdsa | ed25519 | rsa | rsa1] options only Commented Dec 7, 2015 at 6:38
  • So, what should i do then. Moreover when am trying to run the script as sh script1.sh email="[email protected]", no error is being shown, but the variable email can not be passed to the script and $email is being replaced by blank.I cant figure out how to execute the script then. Commented Dec 7, 2015 at 6:45
  • you are accessing email in wrong way inside your script1.sh you need to access it using correct way. most simple is like run your script as sh script1.sh [email protected] and access it inside script using $1 Commented Dec 7, 2015 at 6:49
  • I tried out this and ran the script as sh script1.sh [email protected] and replaced $email with $1, but still it is showing the same error as "too many arguments". Commented Dec 7, 2015 at 7:00
  • What i was trying to say was you can access this argument inside script.sh using $1 to do any other operation like echo or anything else. but you cannot pass with ssh-keygen -t rsa $1 due to reason I mentioned in my first comment. why do you need to pass it with ssh-keygen ?? Commented Dec 7, 2015 at 7:08

1 Answer 1

1

You can run it like below in case you need to pass email address as an argument to ssh-keygen

ssh-keygen -t rsa  -C $1
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.