how to run create file in ubuntu when user login automatically

  • Create a script file, e.g. named my_file.sh, in the /etc/profile.d/ directory.
  • Put #!/bin/bash as the first line.
  • Write whatever command(s) you want to be executed immediately after logging in, e.g. pgrep udhcpd.
  • Mark your file as executable: chmod +x /etc/profile.d/my_file.sh

*It should get executed after login. In case it doesn’t or you don’t have the ability to use root privileges, creating the same file under ~/.config/autostart should work fine (I haven’t tried this directory before).

how to run create file in ubuntu when user login automatically

You can add those lines at the end of your ~/.bashrc file which will get executed when you login.

I’m talking about the ~/.bashrc serverside. When you have added your lines and logout and ssh back in these lines will get executed. You can leave out the last line of your script.

If the ~/.bashrc does not exist you can simply create it or even better copy it:

cp /etc/skel/.bashrc ~/.bashrc

and make sure your ~/.profile file contains the following lines:

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"
    fi
fi

run command in startup ubuntu

  1. Running crontab -e will allow you to edit your cron.
  2. Adding a line like this to it:@reboot /path/to/script will execute that script once your computer boots up.
@reboot /path/to/script

php soap client install ubuntu

In case that you have Ubuntu in your machine, the following steps will help you:

  1. Check first in your php testing file if you have soap (client / server)or not by using phpinfo(); and check results in the browser. In case that you have it, it will seems like the following image ( If not go to step 2 ):
  1. Open your terminal and paste: sudo apt-get install php-soap.
  2. Restart your apache2 server in terminal : sudo service apache2 restart.
  3. To check use your php test file again to be seems like mine in step 1.

In Ubuntu/Debian 

$ php -i | grep -i soap   or $ $ apt-cache search php | grep -i soap
$ sudo apt-get install php-soap
$ sudo  service apache2 restart

or in RHEL/Fedora 

$ yum search php | grep -i soap
$ sudo yum install php-soap

how to login aws using password instead of key file

how to connect filezilla to aws ec2 using password

allow ec2 ubuntu server login using password instead of pem file

To enable a password authentication, you create a password, update the /etc/ssh/sshd_config file, and then restart the SSH service. The following procedure is tested on Amazon Linux, RHEL, SUSE, and Ubuntu.

Note: Using a password-based login rather than key pair authentication has security implications. Therefore, password-based login isn’t recommended. Also, it’s a best practice to minimize the source IP addresses of the security group rules associated with your instance to prevent an SSH attack.

Resolution

1.    From an SSH client, log in to your EC2 instance.

Use one of the following user names:

  • For Amazon Linux, the user name is ec2-user.
  • For RHEL 5, the user name is either root or ec2-user.
  • For Ubuntu, the user name is ubuntu.
  • For SUSE Linux, the user name is either root or ec2-user.

If ec2-user or root doesn’t work, check with your AMI provider.

2.    Set a password for user. The example below uses ec2-user as the user:

$ sudo passwd ec2-user
Changing password for user ec2-user.
New password:
Retype new password:

For example, a successful response looks like this:

passwd: all authentication tokens updated successfully.

3.    Update the PasswordAuthentication parameter in the /etc/ssh/sshd_config file:

PasswordAuthentication yes

4.    Restart the SSH service.

For Amazon Linux, RHEL 5, and SUSE Linux, use this command:

sudo service sshd restart

For Ubuntu, use this command:

sudo service ssh restart

5.    Exit the SSH client, and then log in to test the password authentication.

How to Use Wget in Ubuntu

The wget command allows you to download files from the Internet using a Linux operating system such as Ubuntu. Use this command to download either a single Web page or a complete copy of your company’s website. It also includes an option for downloading any external links included on the site. The command recreates the complete directory structure of the site downloaded on your computer’s hard drive, and you can store the local copy as a backup or use it for testing purposes.

1

Click on the “Search” button in the Ubuntu launcher bar, type “terminal,” then double-click “Terminal” to open the application.

2

Type the following command to install the package, if it is not currently installed:

sudo apt-get install wget

Type your password when prompted.

3

Type the following command to download a single page from the website:

wget http://www.example.com/filename

Replace “www.example.com” with the name of the site you want to download, and replace “filename” with the name of the file you want to download.

4

Type the following command to download an entire website:

wget -r http://www.example.com

5

Type the following command to download the entire website and any external links:

wget -r -H http://www.example.com

Upgrade PHP version 7.2 to 7.3 on Ubuntu

As a part of increasing the security, it is advised to keep your PHP version up to date. Here we have provided the steps to upgrade the current PHP 7.2 version to 7.3 on Ubuntu 14/16/18 versions without removing the old one. So that we can revert to the older versions if something incompatible with the new one after switching.

Login to the server via SSH as root.

Check your current PHP version. 

# php -v
PHP 7.2.36

In order to install PHP 7.3, we need to add the repository first:

# add-apt-repository ppa:ondrej/php

Then run an update:

# apt-get update

After completing the update, we need to install the PHP 7.3.

 Then install the required PHP packages based on your current installation:

# apt install php7.3-common php7.3-cli php7.3-bz2 php7.3-curl php7.3-gd php7.3-intl php7.3-json php7.3-readline php7.3-xml php7.3-zip php7.3-fpm php7.3-bcmath php7.3-mbstring

After a successful installation, we can disable the old 7.2 and then enable 7.3:

# a2dismod php7.2
# a2enmod php7.3

Then restart Apache:

# service apache2 restart

The new PHP version should be active now. You can verify it from the command line:

# php -v
PHP 7.3.28

NOTE: for ordinary user use sudo command.

varnish remove from ubuntu 18.04

uninstall or removes an installed varnish package itself from Ubuntu

$ sudo apt-get remove varnish 

remove varnish and it’s dependent packages which are no longer needed

$ sudo apt-get remove --auto-remove varnish 

use with purge options to varnish package all the configuration and dependent packages will be removed

$ sudo apt-get purge varnish 

purge options along with auto remove, will be removed everything regarding the package

$ sudo apt-get purge --auto-remove varnish 

Email : adityaypi@yahoo.com, Mobile : +91-9555699081

how to map ip address to domain name in ubuntu

ubuntu@nonames:/etc$  hostname --fqdn
nonames.com
ubuntu@nonames:/etc$

Setting your hostname:

  • You’ll want to edit /etc/hostname with your new hostname.
  • Then, run sudo hostname $(cat /etc/hostname).

Setting your domain:

  • Then, in /etc/resolvconf/resolv.conf.d/head, you’ll add then line domain your.domain.name (not your FQDN, just the domainname).
  • Then, run sudo resolvconf -u to update your /etc/resolv.conf (alternatively, just reproduce the previous change into your /etc/resolv.conf).

Both:

Finally, update your /etc/hosts file. There should be at least one line starting with one of your IP (loopback or not), your FQDN and your hostname. grepping out ipv6 addresses, your hosts file could look like this:

127.0.0.1 localhost
1.2.3.4 service.domain.com service
ubuntu@nonames:/etc$ hostnamectl
   Static hostname: nonames.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 0edddc7ee9394aec8b44c30670b611c5
           Boot ID: 4bdaebcdf36a487792fc02abf1a6b958
    Virtualization: xen
  Operating System: Ubuntu 18.04.3 LTS
            Kernel: Linux 4.15.0-1060-aws
      Architecture: x86-64

Multipass 1.0 is out! Get Ubuntu VMs on demand on your Linux, Windows or Mac.

Multipass provides a command line interface to launch, manage and generally fiddle about with instances of Linux. The downloading of a minty-fresh image takes a matter of seconds, and within minutes a VM can be up and running.The Register

  • Ubuntu LTS on tap-Launch instances of Ubuntu and initialize them with cloud-init metadata just like AWS, Azure, Google, IBM and Oracle clouds.
  • Up to date-Automatically fetch and maintain the freshest Ubuntu image from Canonical. Never waste time on updates at launch.
  • Pet, and cattle-Your ‘primary’ instance gets special treatment with integration to your native filesystem and dedicated hot-key access.
  • Native hypervisor-Hyper-V, HyperKit, Virtualbox and KVM are all natively used for the fastest startup time.
  • Optimised guests-Custom tuned Ubuntu kernel is used for each hypervisor for the best I/O and performance.
  • Platform integration-Share files and folders between your normal home directory and your instances.