teleren/devto huggingface dataset:
Use this - My favourite tools
Tags: usethis, linux, opensource, dev
Published: 2020-08-26 00:59:01

---
title: Use this - My favourite tools
published: true
date: 2020-07-30 05:12:00 UTC
tags: Usethis,Linux,Opensource,Dev
canonical_url: https://robbinespu.gitlab.io/blog/2020/07/30/use-this-my-favourite-tools/
---

Assalamualaikum and hello everyone,

I plan to create some blog post section called “Use This”. Have you heard “Use this” before? It about a collection of nerdy interviews asking people from all walks of life what they use to get the job done. But I not going to interview anyone except myself.

![](https://images2.imgbox.com/6f/71/kf6RQbjR_o.png)

Yeah, I gonna post about what softwares, tools, script that I use. It my personal preferences of choices what you want to use and I will just recommend what I use. Maybe this kind of blog post will be useful and I also can jot down my settings and tweaks for everyone and my future references.

It will be cross platform, so Windows and Linux will be listed together. No worries. I will covers opensource, free and commercial software. Each post will hold only just one tools. Not just like regular “use this” interview that put all they favourite into one posts.

Wish me goodluck and not lazy to write down.. haha :stuck\_out\_tongue\_winking\_eye:
Ask Me Anything: Career Development
Tags: etc
Published: 2020-07-30 05:07:05

---
title: Ask Me Anything: Career Development
published: true
description: I'm a software engineer with over 15 years of experience freelancing, contracting, and corporate development. Ask me anything about career development.
tags: Etc
cover_image: https://images.ctfassets.net/f1aa79r6xovt/1Nv2RxfAwt2ONRmMGClUqF/eb323bdf290923d6870aa452b6902317/absolutvision-82TpEld0_e4-unsplash.jpg
canonical_url: https://cole.codes/posts/ask-me-anything-career-development
---
  
  
What questions would you like to ask a Software Engineer about Career Development? 

Ask your questions here:
https://cole.codes/posts/ask-me-anything-career-development

I will also answer questions posted in this thread.
www.mcafee.com/activate 
Published: 2020-07-30 05:00:35

 Mcafee is known for its smart and reliable cybersecurity solutions that guarantee unbeatable protection cover. It offers a wide range of extremely versatile security products that are crafted to cater the requirements of different users and platforms. 
<a href="https://i5mcafee.com/">mcafee.com/activate</a> ,
<a href="https://i5mcafee.com/">mcafee. com/activate key code</a>,
<a href="https://i5mcafee.com/">mcafee. com/activate</a>,
<a href="https://i5mcafee.com/">mcafee com activate</a> ,
<a href="https://i5mcafee.com/">mcafee activate 25 digit code</a> ,
<a href="https://i5mcafee.com/">mcafee activate 25</a>
Awesome Web Effect
Tags: javascript, css, html, react
Published: 2020-07-30 04:42:25

> A series of exquisite and compact web page cool effects

### https://github.com/lindelof/awesome-web-effect

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gts67p9jkc9jxq2mtjjf.png)

#### It's like decorating a beautiful Christmas tree in a room. Sometimes a small web page with cool effects will make your project shine. This is a very fun series, I want to collect those cool effects that are common on the page.

Not limited to any framework (react, vue, angular, etc.), as long as the effect can be simply inserted into the page, you can send it to me, I like them and hope you like them too.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/s0421u0dkc5tc5ct9clp.jpeg)

## Web Effect

I spent a lot of time collecting these fun effects, and I take care of each one. I think it's okay. You have seen a lot of effects that are worth collecting. You can join us.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/hrc5d2ms5176wdhn3aku.png)

## Finally

Finally, I want to say that beautiful things are always refreshing. I hope to dedicate them to you, if you like I will continue to recommend more fun things.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1g0291lb63gk2sjnvuu3.jpg)
Menghindari import bersarang
Tags: react, javascript, productivity
Published: 2020-07-30 04:42:00

Mengimpor file akan menjadi sangat menyakitkan ketika basis kode Anda tumbuh dan menghasilkan file bersarang.
Perhatikan struktur direktori berikut:

```
app/
   components/
     Alert.js
     Button.js
   screens/
     Home.js
     About.js
```

Dengan struktur direktori tersebut, katakanlah Anda ingin mengimpor komponen Button atau Alert, misal: `import Button from ../../components/Button`, ketika lokasi file berubah kita perlu memperbarui pathnya, kalau tidak tentu pasti akan menghasilkan error.

## Menggunakan absolute import
Ada solusi untuk mengatasi ini, yaitu dengan menggunakan absolute import. Selain dapat menghindari error saat lokasi file berubah, penggunaan absolute import juga akan membuat kode menjadi lebih bersih dan tidak rumit.

Pertama, dengan mengkonfigurasi file jsconfig.json di root proyek

```
{
   "compilerOptions": {
      "baseUrl": "app",
   },
   "include" : [ "app" ] 
}
```

Disini Anda perlu mengatur baseUrl ke direktori root yang diperlukan sebagai basis impor sehingga Anda dapat mengimpor komponen dengan jalur absolut. Sekarang, ketika ingin mengimpor komponen cukup dengan cara: `import Button from components/Button`.

Kedua, menambah file package.json ke direktori komponen

```
app/
   components/
     Alert.js
     Button.js
     packages.json
   screens/
     Home.js
     About.js
```

Anda dapat memanfaatkan package.json dengan menambah property name yang nantinya ini akan digunakan sebagai home directory saat import komponen

```
{
   "name": "components"
}
```

Sekarang, ketika ingin mengimpor komponen cukup dengan cara: `import Button from components/Button`.

## Kesimpulan
Dengan memanfaatkan absolute import selain dapat menghindari error saat lokasi file berubah, juga akan membuat kode menjadi lebih bersih. Karena ketika lokasi file berubah Anda tidak perlu memperbarui pathnya, dan saat anda melakukan import file anda tidak perlu mengetahui hirarki file berbeda jika Anda menggunakan relative path.

Reference: https://create-react-app.dev/docs/importing-a-component#absolute-imports
AWS Codebuild: Prepare your own custom build environment 
Tags: aws, devops
Published: 2020-07-04 14:46:49

AWS Codebuild is a fully managed continuous integration service that compiles source code, runs tests, and produces software packages that are ready to deploy.You can create custom build environments that use your own build tools.

This feature caught my attention because I am a little bothered that existing fully managed CI service has  changed their build environment and  our development team took a time to repair the build script.
( Of ourse, you can also get started quickly by using prepackaged build environments on Codebuild )


## How to prepare your own custom build environment

We have to prepare a Docker image for custom build environment. Hopefully, AWS give us sample docker images. You can get them by following.

```
$ git clone https://github.com/aws/aws-codebuild-docker-images.git
$ cd aws-codebuild-docker-images
$ cd ubuntu/standard/4.0
$ docker build -t aws/codebuild/standard:4.0 .
$ ls -1
Dockerfile
amazon-ssm-agent.json
dockerd-entrypoint.sh
legal
runtimes.yml
ssh_config
tools

$ docker run -it --entrypoint sh aws/codebuild/standard:4.0 -c bash
```

In the Dockerfile, various programming language packages, browsers and another build tools are installed
For example:
- ChromeDriver, Chrome, Firefox
- Java, Ruby, Python, PHP,  Golang, Nodejs

You can add or choose packages which you need by customising above Dockerfile.


## Local debugging your custom build environment
You can run Codebuild on your laptop using Docker. You can test and build your custom Codebuild docker image and your application locally before committing.

Pull  the docker image of the local CodeBuild agent.
```bash
docker pull amazon/aws-codebuild-local:latest --disable-content-trust=false
```

Download the shell script named codebuild_build.sh from AWS GIthub
https://github.com/aws/aws-codebuild-docker-images/tree/master/local_builds


```sh
./codebuild_build.sh -i codebuild4-test:1.0 -a /tmp -s /work/repo -m
```
options 
- -i Specify docker image tag of your custom build environment image.
- -a Used to specify an artifact output directory.
- -s Used to specify a source directory. Defaults to the current working directory.
- -m  Used to mount the source directory to the customer build container directly.
- -c Use the AWS configuration and credentials from your local host. This includes ~/.aws and any AWS_* environment variables.

## References
- [AWS Codebuild documentation](https://docs.aws.amazon.com/codebuild/latest/userguide/welcome.html)
傅立葉轉換 (Fourier Transform) 的概念
Tags: fft, dft, fouriertransform
Published: 2020-07-30 04:28:33

### 傅立葉轉換可以做什麼？

傅立葉轉換是很厲害的工具, 可以幫我們分析出合成波中的組成份子, 得到一組簡單波的組合。舉例來說, 像是以下這個合成波：

![](https://i.imgur.com/4WAFLbC.png)

實際上是由以下兩個簡單波組成：

sin(2x\*π)
![](https://i.imgur.com/0OaY4K2.png)
sin(3x\*π)
![](https://i.imgur.com/0YCMnxd.png)

而傅立葉轉換就可以幫你從前面的組合波拆解出來它是 sin(2x\*π) ＋ sin(3x\*π)。那麼傅立葉轉換究竟是如何辦到的呢？

### 傅立葉轉換的基本想法

如果我們把組合的波與其中一個組成份子, 例如 sin(3x\*π) 放在一起觀察：

![](https://i.imgur.com/MP7PjyN.png)

你會看到組合波與這個組成份子有相似性, 但如果非組成份子的簡單波, 例如 sin(x\*π) 放在一起觀察：

![](https://i.imgur.com/05fi0U8.png)

你會發現這兩個波常常會出現波峰對上波谷的情況。

如果想要凸顯這樣的觀察結果, 可能的作法就是把組合波與簡單波相乘, 如果該簡單波是組成份子, 就會因為波峰對波峰、波谷對波谷, 所以相乘後會有許多大的正數；反之, 若不是組成份子的簡單波, 因為常有波峰對波谷的狀況, 相乘後會有許多大的負數, 我們先來試看看。

首先看一下組合波與 sin(3x\*π) 相乘的結果：

![](https://i.imgur.com/mrC3xtn.png)

如果我們把相乘結果的每一點 y 座標加總 (積分) 起來, 就會是一個很大了正數。組合波與 sin(2x\*π) 相乘的結果也類似：

![](https://i.imgur.com/B2xubCo.png)


接著來看一下組合波與 sin(x\*π) 相乘的結果：

![](https://i.imgur.com/5Y9a7ku.png)

你可以看到這個圖形幾乎是對稱的, 如果我們一樣把圖形上每一點的 y 座標加總, 就會是很小的正數, 因為圖形中比較高的波峰與波谷都相抵銷了。組合波與不是組成份子的 sin(6x\*π) 相乘的結果也類似：

![](https://i.imgur.com/GsFePqj.png)

### 傅立葉轉換的運作方法

透過以上的觀察, 我們可以把組合波與簡單波相乘之後加總 (積分) 的值當成是該簡單波在組合波中所佔的強度, 組成份子的簡單波計算出來的強度會遠遠大於非組成份子, 如此一來, 只要用各種簡單波和合成波相乘再加總, 就可以透過相對強度的比較分析出合成波的組成份子了。

### 離散傅立葉轉換 (Discrete Fourier Transform, DFT)

一般常用的其實是**離散傅立葉轉換**, 當我們需要分析自然環境的波時, 會以採樣的方式取得組合波上面的資料點, 由於資料是**不連續**的, 因此稱為『離散』。

實際運算時也不會是代入所有可能的簡單波, 而是以採樣頻率的一半為基準, 再以採樣數往下平均切割成各個頻率區間, 以代表各頻率區間的正弦波進行類似前文提到的計算, 分析出各頻率區間的強度, 找出可能的頻率成分。

>之所以是以採樣頻率的一半為基準, 是因為採樣頻率如果不到特定簡單波頻率的 2 倍, 表示單一完整波的週期裡採樣數就不到 2 個點, 無法從組合波中萃取出完整的簡單波。例如以下的圖中, 若只抽樣這 3 個點, 所代表的波頻率與實際的頻率差多了：

>![](https://i.imgur.com/712N9tp.png)

### 快速傅立葉轉換 (Fast Fourier Transform, FFT)

實際上大家現在所用的都是快速傅立葉轉換, 這是從離散傅立葉轉換加快計算速度而來, 採樣數越多時, 計算所需耗用的時間與原本的離散傅立葉轉換差距越大, 可以大幅縮短計算的時間。

### 結語

以上是相當簡化的傅立葉轉換的概念, 只是為了讓大家可以理解, 實際的運算包含了積分與複數空間, 我們就不細談了。
Shorthand class properties in Typescript
Tags: typescript, todayilearned
Published: 2020-07-30 04:23:05

---
title: Shorthand class properties in Typescript
published: true
description: Today I learned about how to declare class properties in Typescript using the constructor.
tags:
  - typescript
  - TIL
---

**This article was originally published on my website at https://matthewtole.com/articles/til-typescript-class-shorthand/**

---


If you are like me and write Typescript code, you're probably very familiar with how to write classes. Here's an example of a class that you might write.

```typescript
class Player {
  private name: string;
  private age: number;

  constructor(name: string, age: number) {
    this.name = name;
    this.age = age;
  }

  public isOld(): boolean {
    return this.age >= 65;
  }
}
```

At work today I stumbled across some code that I didn't quite understand, but after running some experiments on the [Typescript playground](https://www.typescriptlang.org/play/index.html#code/MYGwhgzhAEAK4E8CmAnaBvAUNawD2AdhAC4oCuwxeKAFAA4oCWAbmMUtAWALZIBc0EkwIBzADTQGLNhzAj+nMtwBGqAJQZs0AL6YtdMspCNg0RhADyIACY01A5XjwgkYAppw4USYmRTviAAtzADo5DgA+AF5oADYAVgBuLV1tIA) and finding a random StackOverflow article talking about it, I realized I have discovered a shorthand way of declaring class properties in Typescript. The same Player class can be written like this.

```typescript
class Player {
  constructor(private name: string, private age: number) {
    // Don't need anything here!
  }

  public isOld(): boolean {
    return this.age >= 65;
  }
}
```

By adding the scope of the properties to the constructor, it automatically creates properties on the class with the same name!

I couldn't find anything about this in the Typescript documentation, or many people using this, but I thought it was pretty cool and wanted to share.
Laravel 7 Multi Language Website Tutorial
Tags: laravel, laravel7
Published: 2020-07-30 04:09:45

This article will give you example of how to create multilingual website in laravel. you can understand a concept of laravel multilingual website example. Here you will learn how to add multiple language in laravel. it's simple example of laravel multi language with language dropdown. Follow bellow tutorial step of laravel multiple language website.

In this example, we will simply use laravel default trans to use multiple language in laravel. we will create three different language English, Franch and Spenish. then we manage it my one dropdown and middleware.

Link: https://www.itsolutionstuff.com/post/how-to-create-multilingual-website-in-laravelexample.html
Deleting Laravel Redis Queue Jobs
Tags: laravelredis, laravelclearqueue, laravel, php
Published: 2021-07-31 14:34:46

---
title: Deleting Laravel Redis Queue Jobs
published: true
date: 2020-07-30 04:00:00 UTC
tags: laravelRedis, laravelclearqueue, laravel, php
canonical_url: https://postsrc.com/posts/deleting-laravel-redis-queue-job
---

![Deleting Laravel Redis Queue Jobs](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wkrfwwhj9s3upil6pbb9.jpg)

There are several ways to delete Laravel Redis queue jobs and below are the available options.  
  

##Option 1 - Laravel Command

The first way to clear a Redis queue is to use the artisan queue clear:command and this is the easiest you can do. Just open up the terminal and type the command below.

```
php artisan queue:clear [connection] [queue]
```

  
This command also works with other queue types such as a database.

  
##Option 2 - Redis CLI

The second way is to use the Redis command and you can access it by typing it below.

```
redis-cli
```

once you are in Redis CLI, just run the command below.  
  

```
FLUSHDB
```

This will clear all of your Redis cached.

  
##Option 3 - Laravel Facade

Thirdly, If you want to use Laravel facade then you can create a **route closure** or **console command** to run the Redis command.

```
use Redis;

Redis::command('flushdb');
```

  
**BONUS:** If you want then you can make use of Laravel tinker.

```
php artisan tinker
```

After that run the command the **flushdb** command by passing it to the method parameters.  
  

```
\\Redis::command(‘flushdb’);
```

Above are some of the ways to clear out your Redis cache, there are other ways but those 3 ways above is the most common one and proven tested.  
  

Thank you for reading the tutorial and I hope you managed to learn something. Do comment below to start the discussion of this topic. Cheers 🍻

[This post was originally published at PostSrc 👑 🚀](https://postsrc.com/). If you like this kind of tutorial, I would really appreciate it if you give it a visit.
cowboy_static で application/wasm を返す
Tags: erlang, cowboy, webassembly
Published: 2020-07-30 03:38:32

この記事は [Cowboy](https://github.com/ninenines/cowboy) を利用していて、 static で wasm ファイルを返したいが cowlib に用意されている mimetype にはデフォルトでは入っていないので、自前でやりたいというマニアックな内容です。

これは検証や開発向けで、そもそも本番では CDN や Nginx で返すべきです。

### cowboy_static

cowboy_static には priv_file があるので、それを使います。
複数の wasm というのはここでは取り扱っていません。

- test アプリケーションの priv/ に wasm.wasm が置いてある
- URL は /test/wasm.wasm でアクセス


```erlang
{"/test/wasm.wasm", cowboy_static,
 {priv_file, test, "wasm.wasm",
  [{mimetypes, {<<"application">>, <<"wasm">>, []}}]}},
```

### 参考

- https://ninenines.eu/docs/en/cowboy/2.8/manual/cowboy_static/
- https://webassembly.org/docs/web/
Day 59 : #100DaysofCode - Focused on My Rails Project
Published: 2020-07-30 03:36:18

Today I focused on my rails project for my #100DaysofCode -- particularly the CSS. For some reason, the CSS is more difficult than building the application for me. I am not sure exactly what I want my app to look like yet. If anyone has any ideas or websites that I can reference for creative CSS ideas for my project, let me know. I hope to get better at CSS with practice. Right now, I still find myself googling best CSS practices. 

Where do you find your CSS creativity? Please share.

As always thanks for reading!

Sincerely,
Brittany

Song of the day:

{% soundcloud https://soundcloud.com/genenoble/the-cost %}
Need a blackhole solution for put.io?
Tags: putio, sonarr, blackhole
Published: 2020-07-30 02:43:08

Need a solution for Sonarr, and putio? 

This is what I came up with. Configure Sonarr to dump torrents to a blackhole directory, modify [this](https://gist.github.com/bdmorin/d3c53e0f495f4947bf61fb55e1c85310) script. Dump it into your launchd/cron solution and you can upload magnets from your blackhole solution to put.io. 

How you download is on you. I might upload my jank solution later. 

Use of "blackhole" is [problematic](https://github.com/rails/rails/issues/33677). Once I have sometime to perform some generic replacement, I'll update this.

Good Luck.

{% gist https://gist.github.com/bdmorin/d3c53e0f495f4947bf61fb55e1c85310 %}
Sorting Your Pandas DataFrame
Published: 2020-07-30 02:34:38

#Introduction

Since writing my first blog on using pandasql I have meant to continue with some other short tutorials on awesome features in pandas to organize your data. So today I am going to talk about using the sort_values function to organize your DataFrame. 

Sort_values is a great feature that can help you reorganize all of that data you found into an understandable table that is pretty and neat and won’t set off the ocd that I know all of you ‘data nerds’ have. If you want to follow along with this example you can find this data located at https://catalog.data.gov/dataset/hpd-crime-incidents under Comma Separated Values File. From there if Downloads folder directly off of your (cant remember word for saved first location in terminal) you can just copy along exactly what I have, if not you will have to change the file path below to where you have the downloaded file saved.

#Importing Data to Pandas

So first thing we are going to import the Pandas library for python because it is the best way to sort/ organize and create a DataFrame. Then we will have Pandas directly convert the .csv file to a DataFrame.

`import pandas as pd`

`data = pd.read_csv(‘~/Downloads/HPD_Crime_Incidents.csv')`


Here we take a look at our DataFrame and see that our data is sorted by the ObjectID, which seems to be the crimes ordered by when they were filed. Though let's say we want the be able to scroll through our data have the crimes organize by what type of crime it was or by the location of the crime or even both.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/chtpjtk0gnafem9fy31g.png)

# Sorting

So now let's take a look at the main parameter of our sort_values function, “by”. This parameter is where you put in the name of the column you want to sort by or a list of columns in the order that you want them sorted. As you can see below I have the data sorted by the location of the crime and then by the type of crime, so that it gives me the types grouped under the location.

`sortdata = data.sort_values(by = ['BlockAddress','Type'])`

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3tzztultae0jblamonmz.png)

#Resetting the Index

Then now that we have our DataFrame sorted the way we would like it you may notice that the index is still set in the original order. Well fear not because if you look a little deeper into the parameters of sort_values we can see we have one called ignore_index, this parameter is key for beautifying your new DataFrame to make it yours. The default setting for this parameter is False but if you change it to true, it will reset your index so that it is now in the order you placed it.

`sortdata = data.sort_values(by = ['BlockAddress','Type'],ignore_index=True)`

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/07tdfitrkznqv9rdblbq.png)

#Conclusion

There you are folks, for those of you just getting started in using pandas or if you just have OCD, you can know sort and clean up your DataFrame.
Google AutoService를 사용할 땐 의존성 순서를 조심해라.
Tags: autoservice, android
Published: 2020-07-15 06:25:55

---
title: Google AutoService를 사용할 땐 의존성 순서를 조심해라.
published: true
description: Google AutoService를 사용할 땐 의존성 순서를 조심해라. 인식되지 않을 수가 있다
tags: autoservice, android
//cover_image: https://direct_url_to_image.jpg
---

구글의 [AutoService](https://github.com/google/auto/tree/master/service) 를 사용하면 손쉽게 ServiceLoader 를 사용할 수 있다.

`AutoService` 프로젝트 소개 문서에 나와있듯,

```java
@AutoService(Processor.class)
final class MyProcessor implements Processor {
  // …
}
```

위와 같이 `Processor`라는 인터페이스의 구현체를 선언하면, 아래와 같이 동적으로 `Processor` 인터페이스의 구현체를 모을 수 있다.

```kotlin
ServiceLoader.load(Processor::class.java, Processor::class.java.classLoader)
```

안드로이드의 경우라면 library project에 이런 구현체를 만들어두고, app project에서 library project들이 제공하는 구현체들을 쉽게 수집할 수 있다.

그런데 어느날, 특정 라이브러리의 구현체를 수집하지 못하는 문제가 발생했다. 다행히 개발 단계에서 바로 크래시가 나서 금방 찾았다. 7개의 구현체가 나와야 하는데, 6개의 구현체가 나왔다.

코드의 문제인가 싶었지만, 코드는 별달리 수정한게 없다. local jvm test를 돌리니 문제가 없었는데 instrumentation test를 돌리니 실패했다. 아흐.

예상되는 문제의 원인은 문제가 되는 라이브러리는 직접 의존하면서 간접 의존하기도 하는데, 뭔가 간접 의존이 먼저 인식이 되어서 그런 것 같다.

즉 아래와 같은 상황에서, gradle이 libB의 직접 의존을 먼저 인식하면 문제가 없고, 간접 의존을 먼저 인식해서 직접 의존을 건너뛰어버리면(이 표현이 맞는지 모르겠다) 문제가 생긴다.

```
app
 ㄴ libA
     ㄴ libB
 ㄴ libB
```

해결 방법은 의존 선언 위치를 바꾸면 된다. 하지만 너무 위험하고, 안정성이 떨어지는 해결책이다. 

```groovy

//실패 : libB의 간접 의존을 먼저 인식
dependencies {
  implementation project(":libA")
  implementation project(":libB")
}

//성공 : libB의 직접 의존을 먼저 인식
dependencies {
  implementation project(":libB")
  implementation project(":libA")
}
```

gradle의 의존 선언 순서에 따라 runtime의 동작이 성공하고 실패하는 아주 위험한 상황이다. 결국 이 경우엔 `AutoService` 적용을 포기했다.

하지만 한 모듈 안에 구현체가 몰려있다면 위와 같은 문제는 발생하지 않기 때문에 꼭 쓰지 말아야 할 필요도 없다. 주의해서 잘 사용하자.
Access EC2 without pem file with with username and password
Tags: security, tutorials, amazon, ec2
Published: 2021-02-01 11:31:49

---
title: Access EC2 without pem file with with username and password
published: true
date: 2020-07-30 01:09:00 UTC
tags: Security,Tutorials,Amazon,ec2
canonical_url: https://boobo94.github.io/devops/access-ec2-with-username-and-password/
---


Sometimes you need to grant permissions to someone else and maybe you don’t want to share the .pem file. By default, the [ssh access](https://boobo94.github.io/devops/generate-ssh-key/) is granted through a .pem file by [Amazon EC2](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html).

1. You can create your own user and access the server using a password. In order to set up this, firstly first let’s login on the server as usual

```sh
$ ssh -i pem_file.pem ubuntu@ec2- ________.compute-1.amazonaws.com
```

2. Create a new user

```sh
$ sudo useradd -s /bin/bash -m -d /home/USERNAME -g root USERNAME
```

3. Add a password

```sh
$ sudo passwd USERNAME
```

4. Add users to sudoers

```sh
$ sudo visudo
```

Here you need to add the following line

```sh
USERNAME ALL=(ALL:ALL) ALL
```

5. Enable the access by password through ssh

```sh
$ vi /etc/ssh/sshd_config
```

Here you need to search _PasswordAuthentication_ from _no_ to _yes_.

6. Restart ssh

```sh
$ sudo /etc/init.d/ssh restart
```

7. Connect to the server using the new user

```sh
$ ssh USERNAME@ec2- ________.compute-1.amazonaws.com
```

This is all.

If you consider this tutorial was useful please let me a comment or share the article. For any suggestions or comments, please drop me a line below.

The post [Access EC2 without pem file with with username and password](https://boobo94.github.io/devops/access-ec2-with-username-and-password/) appeared first on [boobo94](https://boobo94.github.io/).