SSH: packet_write_wait: Broken pipe

SSH won’t establish connection for specific user.

pdeneef@semarang:~# ssh -vvv user@hostname
OpenSSH_6.9p1, LibreSSL 2.1.7
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: ssh_connect: needpriv 0
..
..
Authenticated to hostname ([ip.add.re.s]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
packet_write_wait: Connection to ip.add.re.s: Broken pipe

Resolution:
Remove and recreate user

 $ userdel -r username
$ useradd username
$ passwd username

Retry eting up SSH connection:


pdeneef@semarang:~# ssh user@hostname
user@hostname's password: 
Last failed login: Fri Nov  6 00:42:53 CET 2015 from fromhostname on ssh:notty
There were 2 failed login attempts since the last successful login.
-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
[jforces@one ~]$ 

Maven

Web Application/RESTful service

https://jersey.java.net/documentation/latest/index.html

mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-webapp \
                -DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false \
                -DgroupId=com.welgg -DartifactId=jointforces -Dpackage=com.welgg.jointforces \
                -DarchetypeVersion=2.19

Upon deployment attempt in Glasfish you may get: “An error has occurred Error occurred during deployment: Exception while loading the app : CDI deployment failure:WELD-001408: Unsatisfied dependencies for type Set<Service> with qualifiers @Default at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject com.google.common.util.concurrent.ServiceManager(Set<Service>) at com.google.common.util.concurrent.ServiceManager.<init>(ServiceManager.java:0) . Please see server.log for more details.

Modify important version numbers in pom.xml

  • maven-compiler-plugin: 3.1
  • jersey.version: 2.19

 
Sample App

mvn -B archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes  -DgroupId=nl.welgg.sample   -DartifactId=sample

Replace generated pom.xml
Replace generated App.java

mvn install
java -cp .\target\sample-1.0-SNAPSHOT.jar nl.welgg.sample.App

Make Eclipse ready

mvn eclicpse:eclipse -DdownloadSources
del .project
del .classpath
del .settings
mvn install

Import in Eclipse

Screen Shot 03-21-16 at 02.09 PM

VSFTPD Users

To only allow specified users using FTP

Edit /etc/vsftpd/vsftpd.conf. Add towards the bottom of the file:


userlist_deny=NO
userlist_enable=YES
userlist_file=/etc/vsftpd/vsftpd.allowed_users

Create vsftpd.allowed_users


#To allow just some users to login:
#Code:
#userlist_deny=NO
#userlist_enable=YES
#userlist_file=/etc/vsftpd.allowed_users
#
#In the file /etc/vsftpd.allowed_users add the username of the users that can login.
#The not allowed users will get an error that they can't login before they type their password.
jforces

Restart VSFTPD


$ service vsftpd restart

VSFTPD errors 550, 553

Errors at get and put on commandline and inside FTP Client

ftp> get hello.txt
Response: 550 Failed to open file.
Error: Critical file transfer error

ftp> put hello.txt
Response: 553 Could not create file.
Error: Critical file transfer error

Most likely caused by SE Linux

Check SE status



[root@one ~]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28

If status is enforcing


[root@one ~]# setenforce 0

[root@one ~]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28

Retry ftp and check if problems magically gone away. If so,



[root@one ~]# setenforce 1

[root@one ~]# getsebool -a | grep ftp
ftp_home_dir --> off
ftpd_anon_write --> off
ftpd_connect_all_unreserved --> off
ftpd_connect_db --> off
ftpd_full_access --> off
ftpd_use_cifs --> off
ftpd_use_fusefs --> off
ftpd_use_nfs --> off
ftpd_use_passive_mode --> off

[root@one ~]# setsebool -P ftp_home_dir on

[root@one ~]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28

Installing MySQL on Linux Using the MySQL Yum Repository

Install Guide

http://dev.mysql.com/doc/refman/5.6/en/linux-installation-yum-repo.html


$ service mysqld start

$ ps ax | grep mysql
 4396 ?        Ss     0:00 /bin/bash /usr/bin/mysql-systemd-start post
 5160 pts/2    S+     0:00 /bin/systemctl start mysqld.service

$ mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

After you installed MySQL-community-server 5.7 from fresh on linux, you will need to find the temporary password from /var/log/mysqld.log to login as root.

grep ‘temporary password’ /var/log/mysqld.log
Run mysql_secure_installation to change new password

When running into error 13 or 12, change SELinux and re-install

SE Linux

http://wiki.centos.org/HowTos/SELinux


$ yum remove mysql spullen

$ sestatus

$ edit se linux configuration to disable SELinux

$ yum -y install mysql-community-server

$ service mysqld start

$ ps ax | grep mysql
 14059 ?        Ss     0:00 /bin/sh /usr/bin/mysqld_safe
14208 ?        Sl     0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
14294 pts/0    S+     0:00 mysql
14585 pts/1    S+     0:00 grep --color=auto mysql

N4: Universal Query API

Set up API user

Modify node’s tomcat-users.xml. i.e add n4api user like below:

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
    <role rolename="tomcat"/>
    <role rolename="role1"/>
   <role rolename="n4api"/>
    <user username="tomcat" password="tomcat" roles="tomcat"/>
    <user username="both" password="tomcat" roles="tomcat,role1"/>
    <user username="role1" password="tomcat" roles="role1"/>
   <user username="n4api" password="showmeinfo" roles="n4api"/>
</tomcat-users>


Continue reading

Installation of the 64-bit JDK on RPM-based Linux Platforms

Installation of the 64-bit JDK on RPM-based Linux Platforms

http://docs.oracle.com/javase/7/docs/webnotes/install/linux/linux-jdk.html

This procedure installs the Java Development Kit (JDK) for 64-bit RPM-based Linux platforms, such as Red Hat and SuSE, using an RPM binary file (.rpm) in the system location. You must be root to perform this installation.

These instructions use the following file:

jdk-7u-linux-x64.rpm

1. Download the file. Before the file can be downloaded, you must accept the license agreement.

2. Become root by running su and entering the super-user password.

3. Uninstall any earlier installations of the JDK packages.
# rpm -q -a | grep java

# rpm -e package_name
or
# yum -y remove package_name

4. Install the package.

# rpm -ivh jdk-7u-linux-x64.rpm

To upgrade a package:

# rpm -Uvh jdk-7u-linux-x64.rpm

5. Delete the .rpm file if you want to save disk space.

6. Exit the root shell. No need to reboot.

Oracle DB 12C op Oracle Linux 7

Download de Oracle 12 C database en pak hem uit in OraDB12C


[root@cerita home]# mkdir OraDB12c
[root@cerita home]# cd OraDB12c/
[root@cerita OraDB12c]# mv ../oracle/Downloads/linuxamd64_12102_database_1of2.zip .
[root@cerita OraDB12c]# mv ../oracle/Downloads/linuxamd64_12102_database_2of2.zip .
[root@cerita OraDB12c]# ls
linuxamd64_12102_database_1of2.zip  linuxamd64_12102_database_2of2.zip
[root@cerita OraDB12c]# unzip linuxamd64_12102_database_1of2.zip
[root@cerita OraDB12c]# unzip linuxamd64_12102_database_2of2.zip 

Installeer als user oracle

[oracle@cerita home]$ cd OraDB12c/
[oracle@cerita OraDB12c]$ cd database
[oracle@cerita database]$ ./runInstaller 
Starting Oracle Universal Installer...

De installer komt op een gegeven moment met een scherm over missende prerequisites.
De kernel parameters zijn automatische the fixen, Oracle maakt hier een runfixup script voor.

[root@cerita database]# /tmp/CVU_12.1.0.2.0_oracle/runfixup.sh

maar een aantal libraries moeten nog worden geyummed.


$ yum -y install libaio-devel
$ yum -y install compat-libstdc++-33
$ yum -y install compat-libcap1

Tenslotte vraagt runInstaller nog twee scripts uit te voeren als root.


[root@cerita database]# /home/oracle/app/oraInventory/orainstRoot.sh
Changing permissions of /home/oracle/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /home/oracle/app/oraInventory to oinstall.
The execution of the script is complete.
[root@cerita database]# /home/oracle/app/oracle/product/12.1.0/dbhome_1/root.sh
Performing root user operation.

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /home/oracle/app/oracle/product/12.1.0/dbhome_1

Enter the full pathname of the local bin directory: [/usr/local/bin]: /usr/local/bin
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.

Install Perl DBD::mysql on Oracle Linux/Centos

Install CPAN

yum -y install cpan
cpan App::cpanminus

Install C compiler

[root@yogya ~]# yum -y install cpp

Install MySql developer libraries

[root@yogya mysql-database-stuff]# yum -y install msql-devel

Install DBI and YAML

[root@yogya mysql-database-stuff]# cpan DBI
[root@yogya mysql-database-stuff]# cpan
cpan[2]> install YAML

Om de een of andere reden lukt installeren van DBD::mysql niet met CPAN.
Dus MySql installation from source. Download source distro.

http://search.cpan.org/dist/DBD-mysql/lib/DBD/mysql/INSTALL.pod#Manual_installation


[root@yogya ~]# wget http://cpan.metacpan.org/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.028.tar.gz
[root@yogya ~]# gunzip DBD-mysql-4.028.tar.gz
[root@yogya ~]# tar xvf DBD-mysql-4.028.tar 
[root@yogya ~]# cd DBD-mysql-4.028

Maak even de test database en zet een password voor de root user

mysql> create database test;
mysql> use mysql;
mysql> update user set password = password ( 's3kr1t' ) where user = 'root'

Make sure options match, dus kijk even wat je in moet vullen om de Makefile te bouwen met.

[root@yogya DBD-mysql-4.028]# perl Makefile.PL --help
Usage: perl Makefile.PL [options]

Possible options are:

--cflags= Use for running the C compiler; defaults
to the value of "mysql_config --cflags" or a guessed
value
--libs= Use for running the linker; defaults
to the value of "mysql_config --libs" or a gussed
value
--force-embedded Build version of driver supporting mysqlEmb
--embedded= Use these libs when building the embedded version of
DBD (with --force-embedded). Defaults to the value of
"mysql_config --embedded".
--testdb= Use the database for running the test suite;
defaults to test
--testuser= Use the username for running the test suite;
defaults to no username
--testpassword= Use the password for running the test suite;
defaults to no password
--testhost= Use as a database server for running the
test suite; defaults to localhost.
--testport= Use as the port number of the database;
by default the port number is choosen from the
mysqlclient library
--mysql_config= Specify for mysql_config script
--with-mysql= Specify for the root of the MySQL installation.
--nocatchstderr Supress using the "myld" script that redirects
STDERR while running the linker.
--nofoundrows Change the behavior of $sth->rows() so that it
returns the number of rows physically modified
instead of the rows matched
--ps-protocol Toggle the use of driver emulated prepared statements
prepare, requires MySQL server >= 4.1.3 for
server side prepared statements, off by default
--bind-type-guessing Toggle the use of driver attribute mysql_bind_type_guessing
This feature makes it so driver-emulated prepared statements
try to "guess" if a value being bound is numeric, in which
case, quotes will not be put around the value.
--ssl Enable SSL support
--help Print this message and exit

All options may be configured on the command line. If they are
not present on the command line, then mysql_config is called (if
it can be found):

mysql_config --cflags
mysql_config --libs
mysql_config --embedded
mysql_config --testdb

and so on. See DBD::mysql::INSTALL for details.

Finish installation. In dit geval hoef je alleen het password op te geven.


[root@yogya DBD-mysql-4.028]# perl Makefile.PL --testpassword=s3kr1t
[root@yogya DBD-mysql-4.028]# make
[root@yogya DBD-mysql-4.028]# make test
[root@yogya DBD-mysql-4.028]# make install

					

ffmpeg

./configure --disable-yasm
make
make install

264 is available at ​http://www.videolan.org/developers/x264.html. FFmpeg depends on x264 when compiled with –enable-libx264 and x264 depends on FFmpeg when compiled with –enable-lavf-input. The best way to handle it is to install x264 first without –enable-lavf-input, then compile FFmpeg with –enable-libx264 and finally compile x264 again with –enable-lavf-input.

pdeneef@semarang:~/Projects/media-utils/n2.3# ffmpeg
FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 3 2013 14:56:13 with llvm_gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
configuration: –enable-libmp3lame –enable-shared –disable-mmx –arch=x86_64
libavutil 50.36. 0 / 50.36. 0
libavcore 0.16. 1 / 0.16. 1
libavcodec 52.108. 0 / 52.108. 0
libavformat 52.93. 0 / 52.93. 0
libavdevice 52. 2. 3 / 52. 2. 3
libavfilter 1.74. 0 / 1.74. 0
libswscale 0.12. 0 / 0.12. 0
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…

Use -h to get full help or, even better, run ‘man ffmpeg’
pdeneef@semarang:~/Projects/media-utils/n2.3# ffmppeg
-bash: ffmppeg: command not found
pdeneef@semarang:~/Projects/media-utils/n2.3# ./ffmpeg
ffmpeg version 2.3 Copyright (c) 2000-2014 the FFmpeg developers
built on Jul 26 2014 10:47:31 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
configuration: –disable-yasm
libavutil 52. 92.100 / 52. 92.100
libavcodec 55. 69.100 / 55. 69.100
libavformat 55. 48.100 / 55. 48.100
libavdevice 55. 13.102 / 55. 13.102
libavfilter 4. 11.100 / 4. 11.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…

Use -h to get full help or, even better, run ‘man ffmpeg’
pdeneef@semarang:~/Projects/media-utils/n2.3#