ssh2配置文件详解

ssh2配置文件详解,第1张

看下配置文件就明白了,主要有访问主机,机密方式,端口,协议版本等

cat /etc/ssh/ssh_config

# $OpenBSD: ssh_config,v 1.23 2007/06/08 04:40:40 pvalchev Exp $

# This is the ssh client system-wide configuration file. See

# ssh_config(5) for more information. This file provides defaults for

# users, and the values can be changed in per-user configuration files

# or on the command line.

# Configuration data is parsed as follows:

# 1. command line options

# 2. user-specific file

# 3. system-wide file

# Any configuration value is only changed the first time it is set.

# Thus, host-specific definitions should be at the beginning of the

# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options. For a comprehensive

# list of available options, their meanings and defaults, please see the

# ssh_config(5) man page.

Host *

# ForwardAgent no

# ForwardX11 no

# If you do not trust your remote host (or its administrator), you

# should not forward X11 connections to your local X11-display for

# security reasons: Someone stealing the authentification data on the

# remote side (the "spoofed" X-server by the remote sshd) can read your

# keystrokes as you type, just like any other X11 client could do.

# Set this to "no" here for global effect or in your own ~/.ssh/config

# file if you want to have the remote X11 authentification data to

# expire after two minutes after remote login.

ForwardX11Trusted yes

# RhostsRSAAuthentication no

# RSAAuthentication yes

# PasswordAuthentication yes

# HostbasedAuthentication no

# GSSAPIAuthentication no

# GSSAPIDelegateCredentials no

# BatchMode no

# CheckHostIP yes

# AddressFamily any

# ConnectTimeout 0

# StrictHostKeyChecking ask

# IdentityFile ~/.ssh/identity

# IdentityFile ~/.ssh/id_rsa

# IdentityFile ~/.ssh/id_dsa

# Port 22

Protocol 2

# Cipher 3des

# Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc

# MACs hmac-md5,hmac-sha1,[email protected],hmac-ripemd160

# EscapeChar ~

# Tunnel no

# TunnelDevice any:any

# PermitLocalCommand no

# GSSAPIAuthentication no

# GSSAPIDelegateCredentials no

# Set this to 'yes' to enable support for the deprecated 'gssapi' authentication

# mechanism to OpenSSH 3.8p1. The newer 'gssapi-with-mic' mechanism is included

# in this release. The use of 'gssapi' is deprecated due to the presence of

# potential man-in-the-middle attacks, which 'gssapi-with-mic' is not susceptible to.

# GSSAPIEnableMITMAttack no

# This enables sending locale enviroment variables LC_* LANG, see ssh_config(5).

SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES

SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT

SendEnv LC_IDENTIFICATION LC_ALL

以下是详解Spring的applicationContext.xml文件代码:

<!-- 头文件,主要注意一下编码 -->

<?xml version="1.0" encoding="UTF-8"?>  

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN""

<beans>  

<!-- 建立数据源 -->

<bean id="dataSource"class="org.apache.commons.dbcp.BasicDataSource">

<!-- 数据库驱动,我这里使用的是Mysql数据库 -->

<propertynamepropertyname="driverClassName">  

    <value>com.mysql.jdbc.Driver</value>  

   </property>  

<!-- 数据库地址,这里也要注意一下编码,不然乱码可是很郁闷的哦! -->

<property name="url">  

    <value>  

      jdbc:mysql://localhost:3306/tie?useUnicode=true&characterEncoding=utf-8  

   </value>  

   </property>

<!-- 数据库的用户名 -->

<property name="username">  

    <value>root</value>  

   </property>

<!-- 数据库的密码 -->

<property name="password">  

    <value>123</value>  

   </property>  

</bean>

<!-- 把数据源注入给Session工厂 -->

<bean id="sessionFactory"  

  class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">  

   <property name="dataSource">  

    <ref bean="dataSource" />  

   </property>

 <!-- 配置映射文件 -->

<property name="mappingResources">  

    <list>  

     <value>com/alonely/vo/User.hbm.xml</value>  

    </list>  

   </property>  

</bean>

<!-- 把Session工厂注入给hibernateTemplate -->

<!-- 解释一下hibernateTemplate:hibernateTemplate提供了很多方便的方法,在执行时自动建立 HibernateCallback 对象,例如:load()、get()、save、delete()等方法。 -->

<bean id="hibernateTemplate"  

  class="org.springframework.orm.hibernate3.HibernateTemplate">  

   <constructor-arg>  

    <ref local="sessionFactory" />  

   </constructor-arg>  

</bean>

<!-- 把DAO注入给Session工厂 -->

<bean id="userDAO" class="com.alonely.dao.UserDAO">  

   <property name="sessionFactory">  

    <ref bean="sessionFactory" />  

   </property>  

</bean>

<!-- 把Service注入给DAO -->

<bean id="userService"class="com.alonely.service.UserService">  

   <property name="userDAO">  

    <ref local="userDAO" />  

   </property>  

</bean>

<!-- 把Action注入给Service -->

<bean name="/user"class="com.alonely.struts.action.UserAction">  

   <property name="userService">  

    <ref bean="userService" />  

   </property>  

</bean>  

</beans>

以上Spring的applicationContext.xml文件我是用的SSH架构,如果您用Spring的MVC架构,其原理也是一样的。

下面补充说一下SSH2的方法:

1.导入其他的配置文件。在ssh项目中可以导入其他的配置文件,导入的格式为:

<import resource="classpath:**/applicationContext-bms-sendxml-quartz.xml"/>

这个是导入一个spring的定时任务的配置文件。

2.配置扫描类包并将相应注解纳入spring bean容器,以及启动注解自动注入:

<context:component-scan base-package="com.XX" />

3.spring自己的事务管理:

<tx:annotation-driven />

4.配置配置文件路径(.properties):

<bean id="propertyConfigurer"

class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

<property name="locations">

<list>

<value>classpath:jdbc.properties</value>

<value>classpath:sysconfig.properties</value>

</list>

</property>

</bean>

5.配置数据源:

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"

destroy-method="close">

<property name="driverClass">

<value>${c3p0.jdbc.driverClass}</value>

</property>

<property name="jdbcUrl">

<value>${c3p0.jdbc.url}</value>

</property>

<property name="user">

<value>${c3p0.jdbc.username}</value>

</property>

<property name="password">

<value>${c3p0.jdbc.password}</value>

</property>

<!--初始化时获取的连接数,取值应在minPoolSize与maxPoolSize之间。Default: 3 -->

<property name="initialPoolSize">

<value>${c3p0.jdbc.initialPoolSize}</value>

</property>

<!--连接池中保留的最小连接数。 -->

<property name="minPoolSize">

<value>${c3p0.jdbc.minPoolSize}</value>

</property>

<!--连接池中保留的最大连接数。Default: 15 -->

<property name="maxPoolSize">

<value>${c3p0.jdbc.maxPoolSize}</value>

</property>

<!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->

<property name="maxIdleTime">

<value>${c3p0.jdbc.maxIdleTime}</value>

</property>

<!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3 -->

<property name="acquireIncrement">

<value>${c3p0.jdbc.acquireIncrement}</value>

</property>

<!--每60秒检查所有连接池中的空闲连接。Default: 0 -->

<property name="idleConnectionTestPeriod">

<value>${c3p0.jdbc.idleConnectionTestPeriod}</value>

</property>

</bean>

<bean id="sessionFactory"

class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">

<property name="dataSource">

<ref bean="dataSource" />

</property>

<property name="hibernateProperties">

<props>

<!-- 数据库方言 -->

<prop key="hibernate.dialect">

${hibernate.dialect}

</prop>

<!-- 显示Hibernate持久化 *** 作所生成的SQL语句 -->

<prop key="hibernate.show_sql">false</prop>

<!-- 将SQL脚本进行格式化后再输出 -->

<prop key="hibernate.format_sql">false</prop>

</props>

</property>

<property name="packagesToScan">

<list>

<value>com.avit</value>

</list>

</property>

</bean>

我的回答不是针对楼主的,我是在安装jbpm4.4到tomcat时报的这个错误,原因是tomcat/conf文件夹下的server.xml里的数据库用户名和密码与jbpmhome\install\jdbc文件夹下的mysql.properities没有对应起来,在这里和大家分享一下


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/10081360.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-05
下一篇 2023-05-05

发表评论

登录后才能评论

评论列表(0条)

保存