Get admin details Magento 2

To get magento admin details programatically you need to add below mentioned code in your class. protected $_authSession; public function __construct( ... \Magento\Backend\Model\Auth\Session $authSession, ... ) { ... $this->_authSession = $authSession; ... } public function getAdminUser(){ $user = $this->_authSession->getUser(); //You will get below mentioned admin information. $user->getUserId(); $user->getFirstname(); $user->getLastname(); $user->getEmail(); $user->getUsername(); $user->getPassword(); $user->getCreated(); $user->getModified(); $user->getLogdate(); $user->getLognum(); $user->getReloadAclFlag(); $user->getIsActive(); $user->getExtra(); $user->getRpToken(); $user->getRpTokenCreatedAt(); $user->getInterfaceLocale(); $user->getFailuresNum(); $user->getFirstFailure(); $user->getLockExpires();...
Upgrade magento 2 to latest version

Upgrade magento 2 to latest version

Upgrade magento 2 to latest version Note : Before running upgrade should have to take database and file backup. To upgrade magento 2 from UI you have to follow below mentioned document. http://devdocs.magento.com/guides/v2.0/comp-mgr/upgrader/upgrade-start.html To upgrade magento 2 with composer or command line or SSH use below mentioned command. First of all you you need to update composer. composer update After that check magento version if version is still same use below mentioned command. You have to update magento installer first so apply below mentioned command. composer require magento/magento-composer-installer composer require magento/product-community-edition '2.0.*' --no-update Now you have to run composer update command so it will upgrade php dependency and latest magento packages. composer update Now after done with upgrading all magento and php packages you have to run run below command to make sure that all database base updates are done. php bin/magento setup:upgrade Enjoy your magento 2 should upgraded in latest magento...
Install ClamAV and Scan Viruses with ClamAV

Install ClamAV and Scan Viruses with ClamAV

Installing ClamAV in UBUNTU sudo apt-get install clamav After installation you have to update ClamAV sudo freshclam For scan viruses you have to use below mentioned command. clamscan OPTIONS File/Folder Below mentioned command will check all files in root and displaying the name of each file: clamscan -r / Below mentioned command will check all files in root but only display infected files and ring a bell when found: clamscan -r --bell -i / Below mentioned command will check all files in root but only display infected files when found and have this run in the background: clamscan -r -i / & Below mentioned command will check files in the all users home directories: clamscan -r /home Below mentioned command will check files in the USER home directory and move infected files to another folder: clamscan -r --move=/home/USER/VIRUS /home/USER Below mentioned command will check files in the USER home directory and remove infected files (WARNING: Files are gone.): clamscan -r --remove /home/USER To see all available help options: clamscan --help Note: To see running background process use below mentioned command....
Install ftp on Amazon Ec2

Install ftp on Amazon Ec2

Install ftp on Amanzon Ec2 You can install ftp to your Amazon ec2 instance and able to provide access to other developer to work parallel on same in instance. sudo apt-get install proftpd Configration of ftp sudo vi /etc/proftpd/proftpd.conf Add passive port range PassivePorts 1024 1048 Add public ip MasqueradeAddress 1.1.1.1 Full configration file # # /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file. # To really apply changes reload proftpd after modifications. # # Includes DSO modules Include /etc/proftpd/modules.conf # Set off to disable IPv6 support which is annoying on IPv4 only boxes. UseIPv6 off # If set on you can experience a longer connection delay in many cases. IdentLookups off ServerName "Debian" ServerType standalone DeferWelcome off MultilineRFC2228 on DefaultServer on ShowSymlinks on TimeoutNoTransfer 600 TimeoutStalled 600 TimeoutIdle 1200 DisplayLogin welcome.msg DisplayChdir .message true ListOptions "-l" DenyFilter *.*/ # Use this to jail all users in their homes DefaultRoot ~ # Users require a valid shell listed in /etc/shells to login. # Use this directive to release that constrain. RequireValidShell on # Port 21 is the standard FTP port. Port 21 # In some cases you have to specify passive ports range to by-pass # firewall limitations. Ephemeral ports can be used for that, but # feel free to use a more narrow range. PassivePorts 1024 1048 # If your host was NATted, this option is useful in order to # allow passive tranfers to work. You have to use your public # address and opening the passive ports used on your firewall as well. MasqueradeAddress 174.129.218.53 # This is useful for masquerading address with dynamic IPs:...
Install nginx php-fpm magento 2

Install nginx php-fpm magento 2

Install nginx php-fpm magento 2 Setup dedicated server or Amazon ec2 instance for magento 2. Install nginx, php-fpm and MySql server and setup virtual host configuration. Installation of server. $sudo apt-get update $sudo apt-get install nginx -y Installing php, php-fpm supported extension for magento 2 sudo apt-get -y update sudo add-apt-repository ppa:ondrej/php5-5.6 sudo apt-get -y update sudo apt-get -y install php5 php5-mhash php5-mcrypt php5-curl php5-cli php5-mysql php5-gd php5-intl php5-xsl Installing MySql 5.6 apt-add-repository ppa:ondrej/mysql-5.6 apt-get -y update apt-get -y install mysql-server If you get error : Sub-process /usr/bin/dpkg returned an error code (1) Increase the memory limit of swap Create a 4G swap file: sudo fallocate -l 4G /swapfile Change its permission to only root could access and change: sudo chmod 600 /swapfile Make it swap: sudo mkswap /swapfile Activate: sudo swapon...
Create user on AWS ec2 instance Linux

Create user on AWS ec2 instance Linux

Create user on AWS ec2 instance Linux Create a user for providing access to other developer or use for virtual host in linux. It will also use for providing limited access for user like only read access, read or write access etc. $sudo adduser aman It will ask for new password for the user aman. Note: this password is used to login password for the user when you are using terminal. Granting permission for user aman $sudo visudo Add below mentioned line in the file #User privilege for aman aman ALL=(ALL:ALL) ALL And press CTRL+X for exit, it will ask for save modified changes, Y for the saving modified file. Creating user authorisation to the sever with public key. $su aman $cd home/aman $ssh-keygen -b 1024 -f aman -t dsa $mkdir .ssh $chmod 700 .ssh $cat aman.pub > .ssh/authorized_keys $chmod 600 .ssh/authorized_keys $sudo chown aman:ubuntu .ssh $sudo chown aman:ubuntu .ssh/authorized_keys Note: In above step aman is user and ubuntu is the defult user group. Now you need to download the key “aman” and use it for connecting ssh or...