unable to connect to Ubuntu ami without using KeyPair - linux

I have build an AMI in aws using
Ubuntu Server 16.04 LTS (HVM), SSD Volume Type - ami-0d77397e
Now I might be mis-understanding this, but I don't want to use a keypair as we are sharing this ami around a team. It is in a security group that is locked down to our IP's, so i just want to be able to log in using user/pass
When I try to connect I get the username prompt which I enter the user name Ubuntu in on pressing enter I get this prompt:
Disconnected: No supported authentication methods available (server sent: publickey)

Instead of sharing keys you can create unix users like
1) sudo adduser username -- It will ask you enter password and other details
2) Edit /etc/ssh/sshd_config setting
PasswordAuthentication yes
3) Restart the ssh daemon with
sudo service ssh restart
Now log back in by saying ssh username#ec2_ip and enter the password you just created in 1.

You should use key pairs (multiple, no need to share them), but if you really are resistant then you can enable password logins.

Related

SSH to aks Windows node: azureuser#(windows node internal ip address)'s password

I'm trying to SSH into AKS windows node using this reference which created debugging Linux node, and ssh into the windows node from the debugging node. Once I enter the Linux node and try to SSH into the windows node, it asks me to type in azureuser password like below:
azureuser#10.240.0.128's password:
Permission denied, please try again.
What is azureuser#(windows node internal IP address)'s password? Is it my azure service password or is it a WindowsProfileAdminUserPassword that I pass in when I create an AKS cluster using New-AzAksCluster cmdlet? Or is it my ssh keypair password? If I do not know what it is, is there a way I can reset it? Or is there a way I can create a Windows node free from credentials? Any help is appreciated. Thanks ahead!
It looks like you're trying to login with your password, not your ssh key. Look for the explanation between those methods. These are two different authentication methods. If you want to ssh to your node, you need to chose ssh with key authentication. You can do this by running the command:
ssh -i <id_rsa> azureuser#<your.ip.adress>
But before this, you need to create key pair. It is well done described in this section. Then you can create the SSH connection to a Linux node. You have everything described in detail, step by step, in the documentation you provide.
When you configure everything correctly, you will be able to log into the node using the ssh key pair. You won't need a password. When you execute the command
ssh -i <id_rsa> azureuser#<your.ip.adress>
you should see an output like this:
The authenticity of host '10.240.0.67 (10.240.0.67)' can't be established.
ECDSA key fingerprint is SHA256:1234567890abcdefghijklmnopqrstuvwxyzABCDEFG.
Are you sure you want to continue connecting (yes/no)? yes
[...]
Microsoft Windows [Version 10.0.17763.1935]
(c) 2018 Microsoft Corporation. All rights reserved.
When you see Are you sure you want to continue connecting (yes/no)? you need to write yes and confirm using Enter.

aws ec2 ubuntu require my password

i want to build a project and failed because it requires root permission. When i change the user to root as "sudo -s", it prompted [sudo] password for ubuntu. As ec2 doesn't offer ubuntu password, it login with pem file. How can I login as root and create files? Thanks!
I fixed this by doing using "sudo" for a Ubuntu AWS EC2 SSH Login:
$ sudo passwd ubuntu
Instead of prompting me for:
"(current) UNIX password:"
It prompts now for:
"Enter new UNIX password:"
I hope this fixes some problems with ec2 ubuntu users!
I was surprised as well, when AWS ec2 ubuntu prompted me for a password.
[sudo] password for ubuntu:
In the end I just hit return without inserting anything and it worked.
If you want to run commands from your terminal interactively as root do it as follows:
sudo -i
If just want to run a single command do it as:
sudo some-command-goes-here
You will not be prompted for password in any of these scenario.
AWS doesn't grant root access by default to EC2 instances. This is an important security best practise. Users are supposed to open a ssh connection using the secure key/pair to login as ec2-user. Users are supposed to use the sudo command as ec2-user to obtain elevated privileges.

Vagrant's Ubuntu 16.04 vagrantfile default password

I'm attempting to deploy and run an Ubuntu 16.04 VM via Vagrant 1.9.1.
The Vagrantfile I'm using is from Atlas:
Ubuntu Xenial 16.04 Vagrantfile
I'm using Debian Stretch as the host OS. Vagrant was installed via a .deb available from Vagrant's website.
The Vagrantfile does run and deploy correctly. I can ssh into the VM via both my host OS and using 'vagrant ssh'. However, I have one minor blocker when attempting to ssh in from outside.
The default user in this VM is named 'ubuntu', and looks to have a password set. However, I have no idea what the password is at all, and no docs seem to have the information that I'm looking for. Attempting to set a password via 'passwd' within the VM asks for a current password. Anyone see where this is going?
So my big question is this: has anyone else deployed this same Vagrantfile, and if so, does anyone know what the default user's password is?
As of writing this answer: no one ever publicly shared the password for user ubuntu on ubuntu/xenial64 Vagrant box (see #1569237).
It's not necessary. You can:
login using SSH key authentication
change the password using sudo passwd ubuntu (by default ubuntu user has sudo-permissions with NOPASSWD set)
Actually, not only you can, but you should change the password.
The password is located in the ~/.vagrant.d/ubuntu-VAGRANTSLASH-xenial64/20161221.0.0/virtualbox/Vagrantfile as mention by user #prometee in this launchpad discussion #1569237.
Here is mine (line 8):
# Front load the includes
include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
load include_vagrantfile if File.exist?(include_vagrantfile)
Vagrant.configure("2") do |config|
config.vm.base_mac = "022999D56C03"
config.ssh.username = "ubuntu"
config.ssh.password = "fbcd1ed4fe8c83b157dc6e0f"
config.vm.provider "virtualbox" do |vb|
vb.customize [ "modifyvm", :id, "--uart1", "0x3F8", "4" ]
vb.customize [ "modifyvm", :id, "--uartmode1", "file", File.join(Dir.pwd, "ubuntu-xenial-16.04-cloudimg-console.log") ]
end
end
FYI, user #racb mention in the same discusison that the this bug report having been filed to ubuntu and so far no [...] decision has been made yet about it.
The default user and password is:
user: vagrant
password: vagrant
The new ubuntu/xenial64 image doesn't come with a default username and password. However you can ssh using an ssh-key generated in your vagrant folder.
Let's say your Vagrantfile is at /vagrant/vm01/Vagrantfile, the ssh-key would be in /vagrant/vm01/.vagrant/machines/..../private_key
You can login to your vagrant vm using this private_key. If the guest machine ask for the key's passphrase, just hit ENTER (specifying a blank passphrase). For example, on my Mac:
ssh -i /vagrant/vm01/.vagrant/..../private_key <your vm user>#<your vm ip>:<your vm port>
If you still want to log in using username and password, after logging in using the private_key, you can add your own user for logging in later:
# create a user for log in
sudo useradd yourusername
# specify a password
sudo passwd yourusername
# then type your password when prompted
# add the user to sudo group
sudo adduser yourusername sudo
# create a home folder for your user
sudo mkdir /home/yourusername
# add a shell command for your user (normally /bin/bash)
sudo vim /etc/passwd
# find yourusername line, and add /bin/bash to the end.
# the end result would look like this:
yourusername:x:1020:1021::/home/yourusername:/bin/bash
Now you can ssh using the new username and password.
Not sure about the ubuntu 16.X password when you install through vagrant, but you can change that by your own by following below steps -
[~/from-vagrant-project]vagrant ssh
[ubuntu#hostname]sudo -i
root#hostname:~# passwd ubuntu
Enter new UNIX password:XXXXX
Retype new UNIX password:XXXXX
passwd: password updated successfully`
if this can help:
I solved the custom packaging issue by creating a normal VM (in my case ubuntu/xenial), then copying the Identify file found with vagrant ssh-config and using that file for config.sshprivate_key_path, plus also setting config.ssh.username to ubuntu.
(see also https://github.com/hashicorp/vagrant/issues/5186#issuecomment-355012068)

CoreOS Vagrant Virtual box SSH password

I'm trying to SSH into CoreOS Virtual Box using Putty. I know the username appears in the output when I do Vagrant up but I don't know what the password is.
I've also tried overriding it with config.ssh.password settings in Vagrantfile but when I do vagrant up again it comes up with Authentication failure warning and retries endlessly.
How do we use Putty to log into this Box instance?
By default there is no password set for the core user, only key-based authentication. If you'd like to set a password this can be done via cloud-config.
Place the cloud-config file in a user-data file within the cloned repository. View user-data.sample for an example.
A better method would be to follow this guide so that you can use vagrant ssh as it was designed.
By default for Vagrant:
user: vagrant
password: vagrant
..vagrant up again it comes up with Authentication failure warning and
retries endlessly.
I think because it make connect with wrong ssh public key.
To change it read this: https://stackoverflow.com/a/23554973/3563993

Can't connect to Ubuntu 12.04 Microsoft Azure Instance

I've created a Ubuntu 12.04 virtual machine in Microsoft Windows Azure and set a password. When I use my SSH client to connect to it, I enter the password but the server refuses it and says I'm entering the wrong password. Anyone else experience this problem? Am I doing something wrong?
Thanks!
just make sure about a couple of points which I listed below,
you write your username correct when you connect to your
server, its usually "azureuser" by default
you type in your dns or your global ip correctly
that the status of your virtual machine is "running"
your ssh command looks like this "ssh -p 22
username#dns.cloudapp.net" , note this command is used when u don't
have public key set, but if you do have public key, use this "ssh -p
22 -i key.key username#dns.cloudapp.net" , since you said in your
question , you only set password, then the first ssh command is the
one you should use

Resources