我将公共ssh密钥添加到authorized_keys文件中. ssh localhost
应该登录我而不要求密码.
我这样做并尝试打字ssh localhost
,但它仍然要求我输入密码.我还有其他任何设置可以让它运作吗?
我遵循了更改权限的说明:
如果我这样做,下面是结果 ssh -v localhost
debug1: Reading configuration data /home/john/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/john/.ssh/identity type 1
debug1: identity file /home/john/.ssh/id_rsa type -1
debug1: identity file /home/john/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.7p1 Debian-8ubuntu3
debug1: match: OpenSSH_4.7p1 Debian-8ubuntu3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: …
Run Code Online (Sandbox Code Playgroud) 我正在为sign_in/sign_out程序使用设计宝石.
我使用设计生成了视图文件 rails g devise views
我看到有一个devise/sessions/new.html.erb文件,其中包含sign_in的表单.
我创建了另一个文件devise/sessions/_form.html.erb并<%= render 'form' %>
在new.html.erb文件中完成,并且效果非常好.
现在,我想从不同的控制器中包含这个表单.所以在名为'main'的控制器中,(具体地,在视图页面内)'mains/index.html.erb'我包含了<%= render 'devise/sessions/form' %>
文件.似乎包含工作正常,但我收到以下错误.
NameError in Mains#index
Showing /home/administrator/Ruby/site_v4_ruby/app/views/devise/sessions/_form.html.erb where line #1 raised:
undefined local variable or method `resource' for #<#<Class:0x007f1aa042d530>:0x007f1aa042b870>
Extracted source (around line #1):
1: <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
2: <p><%= f.label :email %><br />
3: <%= f.text_field :email %></p>
4:
Run Code Online (Sandbox Code Playgroud)
似乎form_for(资源,...)部分导致问题(如果我在原始设计sign_in页面上工作正常...我怎么能以rails方式解决这个问题?
我个人更喜欢使用'render'函数来包含表单,而不是内联编写html代码.
我是否必须在'main'控制器中指定某些内容(资源)?
我将感谢你的帮助.谢谢.
我使用跟踪选项B
从分支创建了一个新的git分支A
.
现在,当A
分支通过少量提交更新时,我也想提交提交B
,所以我可以跟踪它,并且有时候不必面对大的改变.
我该怎么做呢?它是在git中自动完成的吗?
有没有简要的指南来解释在实例启动和运行时如何启动应用程序?如果它是通过yum
那时安装的服务之一,我想我可以/sbin/chkconfig
用来将它添加到服务中.(为了确定,这是正确的吗?)
但是,我只想运行未安装的程序yum
.要运行node.js程序,sudo node app.js
只要系统启动,我就必须在主目录下运行脚本.
我不习惯使用Amazon Linux AMI,所以我很难找到一种在每次启动时自动运行某些脚本的"正确"方法.
有一种优雅的方式来做到这一点?
我是否必须date
使用child_process 手动运行命令并从中获取结果以获取日期?有没有其他方式使用节点?
我记得有一个命令将公钥发送到我想要的远程主机.我想使用该功能将我的一个公钥发送到另一个主机.我怎样才能做到这一点?
在我的app.js中,我有3行以下.
var database = require('./database.js');
var client = database.client
var user = require('./user.js');
Run Code Online (Sandbox Code Playgroud)
user.js文件看起来就像普通的帮助器方法.但是,它需要与数据库进行交互.
user.js的
exports.find = function(id){
//client.query.....
}
Run Code Online (Sandbox Code Playgroud)
显然,我想client
在user.js
文件内部使用.无论如何我可以将它传递client
给user.js
文件,而我正在使用require
方法?
我刚刚发现func_get_arg
PHP 中有一个函数可以让开发人员使用获取参数的变体样式.它似乎非常有用,因为参数的数量现在可以是任意的,但我想不出任何使用它的好例子.
使用此函数充分利用其多态特性的一些示例是什么?
在下面的代码中,第一个和第二个打印语句如何打印出SubObj?顶部和子指向同一个Sub类吗?
class Top {
public String f(Object o) {return "Top";}
}
class Sub extends Top {
public String f(String s) {return "Sub";}
public String f(Object o) {return "SubObj";}
}
public class Test {
public static void main(String[] args) {
Sub sub = new Sub();
Top top = sub;
String str = "Something";
Object obj = str;
System.out.println(top.f(obj));
System.out.println(top.f(str));
System.out.println(sub.f(obj));
System.out.println(sub.f(str));
}
}
Run Code Online (Sandbox Code Playgroud)
以上代码返回以下结果.
SubObj
SubObj
SubObj
Sub
Run Code Online (Sandbox Code Playgroud) 好吧,重启可以使用stop和start命令,但我似乎无法使用--auth选项执行mongodb命令.
root@random:/home/random/public_html# mongodb stop
root@random:/home/random/public_html# start mongodb --auth
start: invalid option: --auth
root@random:/home/random/public_html# start mongodb
mongodb start/running, process 29473
root@random:/home/random/public_html#
Run Code Online (Sandbox Code Playgroud)
如何使用--auth选项启动mongodb?
node.js ×3
ssh ×2
amazon-ec2 ×1
devise ×1
git ×1
java ×1
linux ×1
mongodb ×1
overloading ×1
php ×1
public-key ×1